xsl-list
[Top] [All Lists]

newbie Q: how to format xml: <p>normal <b>bold</b> normal </p> :: to xhtml: <p>normal <b>bold</b> normal </p>

2004-09-08 08:26:50
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




<Prev in Thread] Current Thread [Next in Thread>