Member_2_547613
asked on
XPath trouble with attribute value in a predicate
Hi experts,
this is pretty urgent, and I'm running out of ideas.
I'm trying to call a template and pass a parameter based on the content of another node, but I can't figure out how to use an attribute of the context-node as the predicate.
Here are the relevant parts:
values_en.xml with look-up values:
<lov>
<representations>
<simplified>Chinese simplified</simplified>
<pinjin>Pinjin</simplified >
<ipa>Intl. phon. alphabet</ipy>
<foo>Bar</foo>
</representations>
</lov>
someplace early in the xslt file I "load" the file
<xsl:variable name="LOV">
<xsl:copy-of select="document('values_e n.xml')//l ov" />
</xsl:variable>
I'm not sure if this one would be better -- they both seem to work
<xsl:variable name="LOV" select="document('values_e n.xml')//l ov" />
In the XML document (call it main.xml) which is actually beeing processed I have some <element type="simplified"> .. <element type="ipa">, with their 'type' attribute matching one of the possible "representations/*" in "values_en.xml" (hope I explained tis well enough)
Now I want to use the value of element/@type, e.g. type="ipa", to find me the matching //lov/representations/ipa element and assign its content for the parameter.
Here's where I loop through some element list of main.xml to create a html table with these "translated" <representations>. Except for the parameter always being empty, everything is doing fine: the template get's called, renders, it knows all the other elements around, but $Script stays void :-(
<xsl:for-each select="some_element_list" >
<xsl:call-template name="TABLE.TR">
<xsl:with-param name="Script">
<xsl:value-of select="$LOV/representatio ns/type/@v alue" />
</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
Any suggestions?
tia.
CirTap
this is pretty urgent, and I'm running out of ideas.
I'm trying to call a template and pass a parameter based on the content of another node, but I can't figure out how to use an attribute of the context-node as the predicate.
Here are the relevant parts:
values_en.xml with look-up values:
<lov>
<representations>
<simplified>Chinese simplified</simplified>
<pinjin>Pinjin</simplified
<ipa>Intl. phon. alphabet</ipy>
<foo>Bar</foo>
</representations>
</lov>
someplace early in the xslt file I "load" the file
<xsl:variable name="LOV">
<xsl:copy-of select="document('values_e
</xsl:variable>
I'm not sure if this one would be better -- they both seem to work
<xsl:variable name="LOV" select="document('values_e
In the XML document (call it main.xml) which is actually beeing processed I have some <element type="simplified"> .. <element type="ipa">, with their 'type' attribute matching one of the possible "representations/*" in "values_en.xml" (hope I explained tis well enough)
Now I want to use the value of element/@type, e.g. type="ipa", to find me the matching //lov/representations/ipa element and assign its content for the parameter.
Here's where I loop through some element list of main.xml to create a html table with these "translated" <representations>. Except for the parameter always being empty, everything is doing fine: the template get's called, renders, it knows all the other elements around, but $Script stays void :-(
<xsl:for-each select="some_element_list"
<xsl:call-template name="TABLE.TR">
<xsl:with-param name="Script">
<xsl:value-of select="$LOV/representatio
</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
Any suggestions?
tia.
CirTap
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
that worked!
I modified the LOV file a littl so I can use it for other stuff, too
Thanx.
CirTap