X
Xh
Hi all,
I have a problem with generating legend for my data.
I have types and theirs names given like this:
<types>
<type idType="1"><name>Description of type 1</name></type>
<!-- and so on... -->
</types>
And I have my data:
<units>
<unit idUnit="148" idType="1"><!-- stuff here... --></unit>
</units>
I use the for-each loop to iterate through all units, I don't want to
display unit XYZ is of type 1 or 2 or 3...
I wan to use theirs names instead of numbers
I wrote this:
<xsl:for-each select="units/unit">
<xsl:sort select="code"/>
<xsl:value-of select="//types/type[@idType = ./@idType]/name"/>
</xsl:for-each>
but this is wrong since all types have the same <name> value
inside for-each loop current node is ".", but in value-of the same
thing applies and "." becomes the first <type> since all attributes of
types/type are equal to themselves
maybe someone knows how can it be done?
I can not change the names of the attributes I must use them "as
is" (or "as are")
thanks in advance for any help
best regards
Åukasz
I have a problem with generating legend for my data.
I have types and theirs names given like this:
<types>
<type idType="1"><name>Description of type 1</name></type>
<!-- and so on... -->
</types>
And I have my data:
<units>
<unit idUnit="148" idType="1"><!-- stuff here... --></unit>
</units>
I use the for-each loop to iterate through all units, I don't want to
display unit XYZ is of type 1 or 2 or 3...
I wan to use theirs names instead of numbers
I wrote this:
<xsl:for-each select="units/unit">
<xsl:sort select="code"/>
<xsl:value-of select="//types/type[@idType = ./@idType]/name"/>
</xsl:for-each>
but this is wrong since all types have the same <name> value
inside for-each loop current node is ".", but in value-of the same
thing applies and "." becomes the first <type> since all attributes of
types/type are equal to themselves
maybe someone knows how can it be done?
I can not change the names of the attributes I must use them "as
is" (or "as are")
thanks in advance for any help
best regards
Åukasz