xsl-list
[Top] [All Lists]

Re: Understanding Identity Transformations

2005-02-12 13:55:30
Wow.. that is easy except that I do not understand your notice
explanation... the difference between your not( ... ) and your !=.  I
do not see how they would match any differently.  You are saying that
the one in your example only evaluate to true when a cat attribute
exists and not equal to BLUE but in the case where you use the NOT
operand that then this evaluates to true when there  is only... UGGG! 
I can't even ask the question!! : )

So what is the difference then?  I don't get it.


On Sat, 12 Feb 2005 20:34:14 +0100, Joris Gillis <roac(_at_)pandora(_dot_)be> 
wrote:
Tempore 20:20:59, die 02/12/2005 AD, hinc in
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com scripsit Karl Stubsjoen 
<kstubs(_at_)gmail(_dot_)com>:

In the below sample, i'm interested in the "BLUE" categories.  I still
want to bring back the original XML source but omit everything not
"BLUE".  See the FOO cat="GREEN", it contains a cat="BLUE"... of
course I would not expect to return this element since the parent
element cat is "GREEN".


Just insert an empty template that matches all non-BLUE elements:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
<xsl:output method="xml" indent="yes"/>

<xsl:template match="*[(_at_)cat != 'BLUE']"/>

<xsl:template match="@* | node()">
   <xsl:copy>
     <xsl:apply-templates select="@* | node()"/>
   </xsl:copy>
</xsl:template>

</xsl:stylesheet>

(notice that "*[not(@cat='BLUE')]" would not work because the root element
(without a 'cat' attribute) would then never be copied, neither would its
children)


regards,
--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-view.cgi?userid=38041)
Gaudiam omnibus traderat W3C, nec vana fides

--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>
--~--