RE: [xsl] newbie Q: how to format xml: <p>normal <b>bold</b> normal </p> :: to xhtml: <p>normal <b>bold</b> normal </p>

Subject: RE: [xsl] newbie Q: how to format xml: <p>normal <b>bold</b> normal </p> :: to xhtml: <p>normal <b>bold</b> normal </p>
From: cknell@xxxxxxxxxx
Date: Wed, 08 Sep 2004 11:45:14 -0400
<?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@xxxxxxxxxx - email



-----Original Message-----
From:     Ed Eustace <ed.eustace@xxxxxxxxxxxxxxxxx>
Sent:     Wed, 8 Sep 2004 16:26:50 +0100
To:       <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
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.eustace@xxxxxxxxxxxxxxxxx

openDemocracy.net
23 - 25 Gt Sutton Street
London EC1V 0DN

tel: +44 (0) 20 7608 2000
fax: +44 (0) 20 7608 2666

Current Thread