|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: selecting not(node()) not working as I expect it t
select="*" selects the element children only, you want select="node()" which also selects the text nodes. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Spencer Tickner [mailto:spencertickner@xxxxxxxxx] > Sent: 27 February 2006 18:26 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: selecting not(node()) not working as I expect it to > > Hello everyone, > > For some reason (Monday perhaps) I'm having a very difficult time with > a very simple concept. I'm simply trying to apply all templates except > a node and then apply that node and it's children. I've done this > before with no issue,, now, well I'm having issues. > > xml > > <?xml version="1.0"?> > <root> > <para>This is a paragraph</para> > <para>This is a paragraph > <list mark="bull"> > <listitem>This > is a list</listitem> > <listitem>This > is a list</listitem> > </list></para> > <para>This is another paragraph</para> > </root> > > 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> > > <xsl:template match="para"> > <p><xsl:apply-templates select="*[not(self::list)]"/></p> > <xsl:apply-templates select="list"/> > </xsl:template> > <xsl:template match="para/text()"> > <xsl:value-of select="."/> > </xsl:template> > <xsl:template match="list"> > <ul> > <xsl:apply-templates/> > </ul> > </xsl:template> > <xsl:template match="listitem"> > <li><xsl:apply-templates/></li> > </xsl:template> > > expected output > > <p>This is a paragraph</p> > <p>This is a paragraph</p> > <ul> > <li>This is a list</li> > <li>This is a list</li> > </ul> > <p>This is another paragraph</p> > > what I'm getting > > <p/> > <p/><ul> > <li>This is a list</li> > <li>This is a list</li> > </ul> > <p/> > > any thoughts?
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






