Re: [xsl] regarding unique nodes in a nodelist-variable

Subject: Re: [xsl] regarding unique nodes in a nodelist-variable
From: Joerg Heinicke <joerg.heinicke@xxxxxx>
Date: Mon, 30 Dec 2002 05:13:13 +0100
Hello Laura,

you can test your code in a simple way: add the expected structure into an XML file and the XSL code to a simple XSL file:

<xsl:template match="/">
<xsl:for-each select="/elements/element[not(parent/childelement = preceding-sibling::element/parent/childelement)]">
<xsl:value-of select="."/>
</xsl:for-each>
</xsl:template>


You will see that it works like expected. And it's a must, that it works in the same way with variables. The problem can be the implementation of the nodeset() function. It's an extension and so not conform to any specification beside the implementer's one. Extension function should be avoided therefore where possible. What for are you using it? Maybe it's simpler to work without it and use a grouping mechanism like Muenchian Grouping.

Regards,

Joerg

Laura wrote:
Hello all,
This is regarding the sorting on unique nodes. I am using the axis method to
sort it.
eg..
not( parent/child = preceding-sibling::parent/child)

now if i have to go through a nodelist and sort.. can i use the same thing?
like
<xsl:for-each
select="xalan:nodeset($MyElementSet)/elements/element[not(parent/childelemen
t = preceding-sibling::element/parent/childelement)]/>

The structure of the xml in the variable:

<elements>
 <element>
   <parent>
    <childelement>child1</childelement>
   <parent>
 </element>
<element>
   <parent>
    <childelement>child2</childelement>
   <parent>
 </element>
<element>
   <parent>
    <childelement>child1</childelement>
   <parent>
 </element>
</elements>
is this valid? Its not working ..
thanks



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread