[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Match node() with exception
Hi Karl, > This is not working for me: > > <xsl:apply-templates select="node()[not(/SchemaVersion)]"/> > > I have the node "SchemaVersion" which I care to NOT display. What am > I doing wrong? You are selecting all the nodes that do not live in a document where <SchemaVersion> is the root node. The path "/SchemaVersion" returns a node when the <SchemaVersion> element is the root node. The expression "not(/SchemaVersion)" returns true when there isn't such a node. Given that the <SchemaVersion> element is a child of the current node at the point you're using the <xsl:apply-templates> instruction, you should use: <xsl:apply-tempaltes select="node()[not(self::SchemaVersion)]" /> self::SchemaVersion selects the node itself if it is a <SchemaVersion> element. "not(self::SchemaVersion)" returns true only if the context node isn't a <SchemaVersion> element. So "node()[not(self::SchemaVersion)]" selects only those nodes that aren't, themselves, <SchemaVersion> elements. Alternatively, you could select all nodes with: <xsl:apply-templates select="node()" /> or, since the select attribute defaults to "node()", simply: <xsl:apply-templates /> and then have a template that does nothing when the <SchemaVersion> element is processed: <xsl:template match="SchemaVersion" /> Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/
|
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
|