[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

Subject: Re: selecting not(node()) not working as I expect it to
From: "Spencer Tickner" <spencertickner@xxxxxxxxx>
Date: Mon, 27 Feb 2006 10:47:06 -0800
not node
Perfect, thanks a lot Michael.


On 2/27/06, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> 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?

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.