[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: the "use" parameter for a key is to be a path expr
Hi Tom, > You were right about the leading and trailing spaces, but I'm > intruiged that you say that the use parameter for a key has to be an > XPath expression: in that case what about all the examples I have > seen using concat(@this,'+',@that)? The XPath: concat(@this, '+', @that) *is* an expression. Possibly you (or Tom P?) are confusing the general term "expression" with the more specific term "path expression" - a path expression is just one kind of expression, function calls are another, literal strings are another and so on. The use attribute takes an expression, which can be any of those sorts of expression. (Check http://www.w3.org/TR/xslt#key and http://www.w3.org/TR/xpath#NT-Expr if you don't believe me!) So: <xsl:key name="billcodes" match="Billcode" select="concat(@corp, '+', @country)" /> Should be just fine, though given your whitespace issues, probably: <xsl:key name="billcodes" match="Billcode" select="concat(normalize-space(@corp), '+', normalize-space(@country))" /> Would be safer! That should enable you to do: key('billcodes', 'EvilEmpire+USA') to get back the Billcode elements whose @corp attribute has the value 'EvilEmpire' (or even ' EvilEmpire ') and whose @country attribute has the value 'USA' (or, again, ' USA '). Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|