<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" encoding="UTF-8" />
<xsl:strip-space elements="article body module mbody" />
<xsl:template match="/article/body/module/mbody">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="p">
<xsl:copy-of select="." />
</xsl:template>
</xsl:stylesheet>
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email
-----Original Message-----
From: Ed Eustace <ed(_dot_)eustace(_at_)opendemocracy(_dot_)net>
Sent: Wed, 8 Sep 2004 16:26:50 +0100
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
Subject: [xsl] newbie Q: how to format xml: <p>normal <b>bold</b> normal </p>
:: to xhtml: <p>normal <b>bold</b> normal </p>
Hi,
I've been looking through the archives and I couldn't see anything that
matches this question. Excuse me if this is a repeat.
Heres my xml:
<article>
<body>
<module>
<mbody>
<p>some normal text <b>the bold text</b> back to
normal </p>
<p>some more normal text <b>the bold text</b>
back to normal <b>and bold again</b></p>
</mbody>
</module>
</body>
</article>
heres the xsl:
..
<xsl:template match = "/" >
<xsl:for-each select="article/body/module">
<!-- mbody p-->
<xsl:for-each select="mbody/p">
<xsl:apply-templates select = "//p" />
<xsl:apply-templates select = "//b"/>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
<xsl:template match = "p" >
<xsl:value-of select = "." />
</xsl:template>
<xsl:template match = "b" >
<b> <xsl:value-of select = "." /></b>
</xsl:template>
..
and the xhtml I want should be:
..
<p>some normal text <b>the bold text</b> back to normal </p>
<p>some more normal text <b>the bold text</b> back to normal <b>and bold
again</b></p>
instead it displays the p tag then goes and does the b tag at the end.
Any guidance on this matter would be most appreciated.
ed
ed eustace
ed(_dot_)eustace(_at_)opendemocracy(_dot_)net
openDemocracy.net
23 - 25 Gt Sutton Street
London EC1V 0DN
tel: +44 (0) 20 7608 2000
fax: +44 (0) 20 7608 2666
--+------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--