[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: xsl-list Digest 22 Jan 2005 06:10:00 -0000 Issue 3

Subject: Re: xsl-list Digest 22 Jan 2005 06:10:00 -0000 Issue 305
From: Lars Huttar <lars@xxxxxxxxxx>
Date: Sat, 22 Jan 2005 07:44:08 -0600
 Re: xsl-list Digest 22 Jan 2005 06:10:00 -0000 Issue 3
jvalentin wrote:

i am using this duplicate removing xsl script:
<xsl:template match = "/">
 <!-- predicate to avoid node ABC... group repetition -->
 <xsl:apply-templates select="/xml/el[not(node=following::node)]">
   <xsl:sort select="node" />
 </xsl:apply-templates>
</xsl:template>

<xsl:template match="el">
 <xsl:value-of select="node">-<xsl:call-template
name="XXX"><xsl:with-param name="node" ><xsl:value-of select="node"
/></xsl:with-param></xsl:call-template>
</xsl:template>

<xsl:template name="XXX">
 <!--
 when using:
 <xsl:for-each
select="/xml/el[node=$node]/rel/el/node[not(text()=following::text())]">
 the first predicate is not accounted for, and all XYZ are visible and i
get this:
       A-Y
       B-X
       C-Z

 and if i use this axe:
 <xsl:for-each
select="/xml/el[node=$node]/rel/el/node[not(text()=following-sibling::text())]">
 i get again all with duplicates:
       A-XXY
       B-XZZ
       C-Z

 when i use no last predicate:
 <xsl:for-each select="/xml/el[node=$node]/rel/el/node">
 intra-class ABC duplicates remain:
       A-XXY
       B-XZZ
       C-Z
 -->
   <xsl:value-of select="text()">
 </xsl:for-each>
</xsl:template>

any idea on what's the reason for this behaviour of predicate [node=$node]
(i tried keys with the same result)

thanks


The predicate is working, i.e. when you call template "XXX" with a value of 'A' for parameter "node", the template only outputs the names of nodes related to the 'A' element.
What the predicate doesn't do is restrict the range of the following:: and following-sibling:: axes.
So when you are looking at node A-X and you ask if there is a following text node whose value is 'X', the answer is yes because there is one under B.


Lars

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-2013 All Rights Reserved.