You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2001/04/19 23:59:46 UTC
[Bug 1414] New - template pattern and sort order
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1414
*** shadow/1414 Thu Apr 19 14:59:46 2001
--- shadow/1414.tmp.3315 Thu Apr 19 14:59:46 2001
***************
*** 0 ****
--- 1,45 ----
+ +============================================================================+
+ | template pattern and sort order |
+ +----------------------------------------------------------------------------+
+ | Bug #: 1414 Product: XalanJ2 |
+ | Status: NEW Version: 2.0.1 |
+ | Resolution: Platform: PC |
+ | Severity: Normal OS/Version: |
+ | Priority: Component: Xalan |
+ +----------------------------------------------------------------------------+
+ | Assigned To: xalan-dev@xml.apache.org |
+ | Reported By: slobo@matavnet.hu |
+ | CC list: Cc: |
+ +----------------------------------------------------------------------------+
+ | URL: |
+ +============================================================================+
+ | DESCRIPTION |
+ if i want to emit the name attribute of the foo element that has the lowest bar
+ attribute i would write something like:
+
+ <xsl:template match="...">
+ <xsl:apply-templates select="foo">
+ <xsl:sort select="@bar"/>
+ </xsl:apply-templates>
+ </xsl:template>
+ <xsl:template match="foo[position()=1]">
+ <xsl:value-of select="@name"/>
+ </xsl:template>
+
+ the problem with this is that i get the first element by the document order,
+ not by the sort order
+
+ a more interesting variation of this example is this:
+
+ <xsl:template match="...">
+ <xsl:apply-templates select="foo">
+ <xsl:sort select="@bar"/>
+ </xsl:apply-templates>
+ </xsl:template>
+ <xsl:template match="foo[position()=1]">
+ <xsl:value-of select="position()"/>
+ </xsl:template>
+
+ here i emit the position() instead of the name attribute
+ in general it doesn't emit 1, which is quite strange, as the match pattern
+ looks for position()=1