Subject: Re: [xsl] Using "except" with node sequences From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Mon, 04 Aug 2008 13:55:28 -0400 |
I have a sequence of nodes stored in a variable,
and I am attempting to filter it using an XPath expression that includes the "except" operator. However, it's not working like I expect it to.
...
I am attempting to filter it using this logic:
<olddata>
<xsl:sequence select="$normalized_data[not(info/@action='delete')] except $normalized_data[info/@action='insert' or info/@action='modify']" />
</olddata>
I expect the returned sequence to include all of the nodes in $normalized_data that match the first condition and don't match the second condition (node 3). What I am actually getting is all of the nodes in $normalized data. Is there something about the "except" operator that I'm not understanding?
T:\ftemp>type james.xsl <?xml version="1.0" encoding="US-ASCII"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:variable name="normalized_data"> <data id="1"> <info action="delete" /> <info action="insert" /> <stuff /> </data> <data id="2"> <info action="insert" /> <stuff /> </data> <data id="3"> <stuff /> </data> </xsl:variable>
<xsl:variable name="normalized_data_ken" as="element(data)+"> <data id="1"> <info action="delete" /> <info action="insert" /> <stuff /> </data> <data id="2"> <info action="insert" /> <stuff /> </data> <data id="3"> <stuff /> </data> </xsl:variable>
</xsl:stylesheet> T:\ftemp>call xslt2 james.xsl james.xsl james.xml
T:\ftemp>type james.xml <?xml version="1.0" encoding="UTF-8"?> <results> <james> <olddata> <data id="1"> <info action="delete"/> <info action="insert"/> <stuff/> </data> <data id="2"> <info action="insert"/> <stuff/> </data> <data id="3"> <stuff/> </data> </olddata> </james> <ken> <data id="3"> <stuff/> </data> </ken> </results> T:\ftemp>rem Done!
-- Upcoming XSLT/XSL-FO hands-on courses: Wellington, NZ 2009-01 World-wide corporate, govt. & user group XML, XSL and UBL training RSS feeds: publicly-available developer resources and training G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Using "except" with node sequ, James Sulak | Thread | RE: [xsl] Using "except" with node , James Sulak |
[xsl] Using "except" with node sequ, James Sulak | Date | RE: [xsl] XSLT 1 vs. 2 stylesheet p, Michael Kay |
Month |