[no subject]

So "are unioned together" results in a node-set and that does not contain
duplicates.

Now how can this algorithm step be realized in XPATH 1.0 plus
exslt:node-set
funtion?
(this would work in browsers with the technique from David Carlisle [1])


This is the output for below stylesheet simple.xsl on file simple.xml.
For the nodes four node /a/b/c their parents are copied into an
intermediate
result. But xsltproc and xalan show that the four nodes are different by
the
their generate-id() values, whereas the first pair and last pair are
representations of the same node.

xsltproc        xalan
1: id2659470    1: AbT0
2: id2659470    2: AbT0
3: id2659354    3: AbT1
4: id2659354    4: AbT1

1: id2659234    1: AbT2
2: id2659244    2: AbT3
3: id2659254    3: AbT4
4: id2659264    4: AbT5

1: <b>          1: <b>
    <c>1</c>        <c>1</c>
    <c>2</c>        <c>2</c>
  </b>            </b>
2: <b>          2: <b>
    <c>1</c>        <c>1</c>
    <c>2</c>        <c>2</c>
  </b>            </b>
3: <b>          3: <b>
    <c>1</c>        <c>1</c>
    <c>2</c>        <c>2</c>
  </b>            </b>
4: <b>          4: <b>
    <c>1</c>        <c>1</c>
    <c>2</c>        <c>2</c>
  </b>            </b>



$ cat simple.xml
<a>
  <b>
    <c>1</c>
    <c>2</c>
  </b>
  <b>
    <c>1</c>
    <c>2</c>
  </b>
</a>
$ cat simple.xsl
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:exsl="http://exslt.org/common";
>
  <xsl:output omit-xml-declaration="yes"/>

  <xsl:template match="/">
    <xsl:variable name="rtf">
      <xsl:for-each select="/a/b/c">
        <xsl:copy-of select=".."/>
      </xsl:for-each>
    </xsl:variable>

    <xsl:for-each select="/a/b/c">
      <xsl:value-of select="position()"/><xsl:text>: </xsl:text>
      <xsl:value-of select="generate-id(..)"/><xsl:text>&#10;</xsl:text>
    </xsl:for-each>

    <xsl:text>&#10;</xsl:text>

    <xsl:for-each select="exsl:node-set($rtf)/*">
      <xsl:value-of select="position()"/><xsl:text>: </xsl:text>
      <xsl:value-of select="generate-id(.)"/><xsl:text>&#10;</xsl:text>
    </xsl:for-each>

    <xsl:text>&#10;</xsl:text>

    <xsl:for-each select="exsl:node-set($rtf)/*">
      <xsl:value-of select="position()"/><xsl:text>: </xsl:text>
      <xsl:copy-of select="."/><xsl:text>&#10;</xsl:text>
    </xsl:for-each>
  </xsl:template>

</xsl:stylesheet>
$


[1] http://dpcarlisle.blogspot.com/2007/05/exslt-node-set-function.html


Mit besten Gruessen / Best wishes,

Hermann Stamm-Wilbrandt
Developer, XML Compiler, L3
WebSphere DataPower SOA Appliances
----------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

Current Thread