We have a project where we have a mapping in which we have to sort on a value with is retrieved from another branch by using a reference (kind of foreign key).
To be able to make the association, the current() function is needed.
The problem is that it doesn't work when it's used in the sort expression, but when we use the same expression to retrieve a value, it does work.
It does work in other IDE's, like Eclipse.
I've got two questions:
- Is this a bug in SOA Suite? (and JDeveloper).
- Is there a work around, so we can deliver the functionallity?
The real xsl is quite complex, but I've reduced to problem to the code below.
XSL with sort containing current function:
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:tst="test">
<xsl:template match="/">
<Output>
<xsl:for-each select="tst:example/tst:items/tst:item">
<xsl:sort select="/tst:example/tst:chars/tst:char[@id=current()/@idref]"/>
<out>
<xsl:value-of select="/tst:example/tst:chars/tst:char[@id=current()/@idref]"/>
</out>
</xsl:for-each>
</Output>
</xsl:template>
</xsl:stylesheet>
Example input:
<example xmlns="test">
<chars>
<char id="id1">A</char>
<char id="id2">B</char>
<char id="id3">C</char>
</chars>
<items>
<item idref="id3">Three</item>
<item idref="id2">Two</item>
<item idref="id1">One</item>
</items>
</example>
Output in SOA Suite (and test in JDeveloper):
<Output xmlns:tst="test"><out>C</out><out>B</out><out>A</out></Output>
Expected output (e.g. Eclipse does return this):
<Output xmlns:tst="test"><out>A</out><out>B</out><out>C</out></Output>