Subject: RE: [xsl] XSL String Mapping Problem. From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Wed, 10 Dec 2008 10:35:30 -0000 |
> I used the XML/XSL snippet below. However the "@key eq ." > seems not to work. > > If I introduce a variable it works fine: > > <xsl:variable name="var" select="."/> > <xsl:value-of select="$map[@key eq $var]/@val"/> "." within a predicate refers to the node that you are testing against the predicate. This is the problem with context dependency - it's nice and convenient when it does what you are expecting, and it's a rich source of bugs when it doesn't. > > Questions: > > 1. How to get this mapper working without variable? You could use current(), but I'd be inclined to use the variable. > 2. What is the the 'defacto XPath standard' for mapping a > list hardcoded keys to hardcoded values? The above is fine - though in XSLT, unless you have a processor with an unusually good optimizer, like Saxon-SA ;-), you can speed it up using keys. Michael Kay http://www.saxonica.com/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] XSL String Mapping Problem., Jos van Roosmalen | Thread | Re: [xsl] XSL String Mapping Proble, G. Ken Holman |
[xsl] XSL String Mapping Problem., Jos van Roosmalen | Date | [xsl] key from one file to another , Ganesh Babu N |
Month |