xsl-list
[Top] [All Lists]

Re: [xsl] What is the equivalent of this statement ?

2012-07-13 13:06:26
On Sat, 2012-07-14 at 00:47 +0700, Lucent Lau wrote:
Hello,

If I have this XML structure:

<root>
<elemA>
     <elemB>
         <elemC id="1"/>
</elemB>
</elemA>
</root>

what is the equivalent of this statement if I do not want to
specifically use elemC
<xsl:apply-templates select="node()[ not( self::elemC[@id=('1')])]" />

Can I say:
<xsl:apply-templates select="node()[ not( self::elemA/*/*[@id=('1')])]" />

No, because there's no elemA in the same context as an elemC.
Presumably this is in a template that matches elemB, and you are
processing the whitespace node but not the selcted element node.

I'd probably have an empty template with
  match="elemA/elemB/elemC[id = 1]"

and then just use apply-templates.

You could also say, node()[not(@id = 1)] if no other element has @id.

Liam

-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

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