[Home] [By Thread] [By Date] [Recent Entries]
Hi List,
Thanks in advance for the help. I'd like to blame this one on Monday, except for the fact that it isn't... I'm attempting to apply-templates to my paragraph elements and then apply-templates to my list elements as the list elements are currently embedded in the paragraph elements. INPUT <?xml version="1.0"?> <para.appl>Blah Blah <term>foo</term> to <term>bar</term> for <term>foo</term>, Blah Blah: <list.appl> <listitem.appl>Bullet 1</listitem.appl> <listitem.appl>Bullet 2 <term refid="wtr-tm">bar</term></listitem.appl> </list.appl> </para.appl> XSL <?xml version='1.0'?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <!-- This is the weird Part --> <xsl:template match="para.appl"> <p><xsl:apply-templates select="*[not(descendant-or-self::list.appl)]"/></p> <xsl:apply-templates select="list.appl"/> </xsl:template> <xsl:template match="list.appl"> <ul> <xsl:apply-templates/> </ul> </xsl:template> <xsl:template match="listitem.appl"> <li><xsl:apply-templates/></li> </xsl:template> <xsl:template match="term"> <em><xsl:apply-templates/></em> </xsl:template> </xsl:stylesheet> OUTPUT <p><em>foo</em><em>bar</em><em>foo</em></p><ul> <li>Bullet 1</li> <li>Bullet 2 <em>bar</em></li> </ul> DESIRED OUTPUT <p>Blah Blah <em>foo</em> to <em>bar</em> for <em>foo</em>, Blah Blah:</p> <ul> <li>Bullet 1</li> <li>Bullet 2 <em>bar</em></li> </ul>
Thanks in advance for the help Spencer
|

Cart



