Subject: Re: [xsl] WG: key multiple select From: David Carlisle <davidc@xxxxxxxxx> Date: Mon, 4 Apr 2005 14:04:47 +0100 |
Firstly you should remove all uses of disable-output-escaping="yes" which almost always indicate a design error in the stylesheet. If using XSLt you should aim to generate a tree of element nodes, not the text markup of an XML document tagging. You haven't really given a description of teh problem that you are trying to solve, however in <xsl:variable name="pageid" select="$dfile[key('pageid', concat(id, '+', $catid))]"/> The current node after $dfile[ is the root node (/) of the document referenced by $datafile) so the first id used in your concat(id will be the empty string unless id is the top level element of $datafile, and will be the whole string content of $datafile if its top level element is id. I doubt this is what you intended, but can't suggest a fix given teh available information. Similarly <xsl:key name="pageid" match="siteinfo/pages/page/id" use="concat(id, '+', category)"/> here the current node for the use expression is the matched id node, so the id and category expressions used in the concat are selecting children of this id element. Do you id elements really have child elements called id? <id> <![CDATA[1]] </id> That is not well formed, it should have ]]> not just ]], I will assume that that was just a cut and paste error and your real input is well formed. If your input looks like this you almost certainly want to use normalize-space function when generating the keys and looking them up with key() the string value of that id element is is newline tab space space tab 1 newline tab space space and so if you just use the string value of id to generate the key you will have to generate exactly the same string when searching for teh node with key() Perhaps though your real input doesn't have the indentation? The CDATA section of course isn't doing anything, that only affects teh interpretation of < and & so your input is equivalent to <id> 1 </id> David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] WG: key multiple select, Studio Codeworx | Thread | [xsl] xsl: preserving spaces prese, josh higgins |
RE: [xsl] Testing 2 XML documents f, Mukul Gandhi | Date | Re: [xsl] Testing 2 XML documents f, David Carlisle |
Month |