Subject: Re: [xsl] Specify/determine element's "logical" parent From: David Carlisle <davidc@xxxxxxxxx> Date: Thu, 23 Sep 2004 23:08:55 +0100 |
> , but I seem to be headed down a very deep and dark path with XSL. probably but remember many of us find that walking along such paths is fun, perhaps you're more of a city dweller and more comfortable following the crowds? > I would be happy to RTFM if I could just find the FM everything is in the Xpath and xslt Recommendations online at w3.org/TR that's all many of us used, although by now there are plenty of online tutorials as well. > For instance, I do not understand the difference between the two templates > listed below, which seem equivalent to me. one has <xsl:value-of select="key( 'ids', @parentid )" /> the other has <xsl:value-of select="key( 'ids', @parentid )/@id" /> these are not at all equivalent, in both cases the key() will select the element node with the specified id but in the first case you select the string value of the element (ie all the character data of all its descendents) and in the second you select the string value of the id attribute. incidentally the xsl:choose can be simplified to <xsl:value-of select="key( 'ids', (@parentid|../@id)[last()])/@id" /> so you don't really need the $parent variable at all you can just do <xsl:value-of select="@id" /> is [<xsl:value-of select="key( 'ids', (@parentid|../@id)[last()])/@id" />]<br /> > Nor do I understand why when both templates are in a single > stylesheet, only one (the latter?) seems to get applied. actually it's an error to have two templates of the same priority matching the same node, the system may recover by using one of them but it's best to avoid the error condition. This error is really enforced by XSLTs processing model, it would be hard to think of a meaning for applying two templates at the same point in the input. 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 -> |
---|---|---|
Re: [xsl] Specify/determine element, john-xsl-list | Thread | Re: [xsl] Specify/determine element, john-xsl-list |
Re: [xsl] Reading the values of ele, David Adams | Date | Re: [xsl] Sibling access in XSL !, JBryant |
Month |