Subject: Re: [xsl] Applying contains() to multiple nodes problem From: David Carlisle <davidc@xxxxxxxxx> Date: Thu, 4 Oct 2007 14:49:54 +0100 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform " That should generate an error about missing xsl namespace (because of the space) $ saxon reac.xml reac.xsl Error Namespace for stylesheet element should be http://www.w3.org/1999/XSL/Transform Transformation failed: Namespace for stylesheet element should be http://www.w3.org/1999/XSL/Transform fixing that gives the result you posted "contains(//entry/@reaction, $rea)" in xslt 2 that would be an error (multiple nodes supplied as 1st argument.) in XSLT1 line most string functions contains will silently dicard all but the first node, so it is the same as "contains((//entry/@reaction)[1], $rea)" what you want is to check each node individually, so "//entry[contains(@reaction, $rea)]" you then get the reult that you wanted however note that // is an expendive operation and you do it lots of times (unless syour xslt engine optimises this away for you) You could use a key to optimise this but that's rather easier in xslt2 than xslt1 as you want to key off the reaction element after spliiting on white space. David ________________________________________________________________________ The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Applying contains() to multip, Ioannis Kanaris | Thread | [xsl] Transforming RDF with XSLT, John Smith |
[xsl] Transforming RDF with XSLT, John Smith | Date | Re: [xsl] Transforming RDF with XSL, M. David Peterson |
Month |