This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: how to use // starting from the root, when i am few steps under the root,
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: how to use // starting from the root, when i am few steps under the root,
- From: David Allouche <david at ansible dot xlii dot org>
- Date: Tue, 22 Aug 2000 10:33:00 -0200 (GMT+2)
- Reply-To: xsl-list at mulberrytech dot com
> <root>
> <one>
> <two>
> <applytemplates select="what to put here if i
> want to start from the root//ten"
I am not sure what you mean here. (and there is a typo in
apply-templates name...). This does not make any sense either as a source
document or as a stylesheet.
One interpretation would be:
- source document -
<one>
<two>
<three/>
....
</two>
...
<ten/>
...
</one>
- - -
- stylesheet -
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
...
<xsl:template match="two">
<xsl:apply-template select="something that match the element ten
wherever it may be in the source tree"/>
</xsl:template>
...
</xsl:stylesheet>
- - -
Here the correct select attribute is select="//ten"
Using select=".//ten" would select any element named ten (in the null URI
namespace) which is at least a grandchildren of the context node (an
element named two, as says the match attribute of the xsl:template
element).
Another interpretation would be that your are using the simplified
stylesheet syntax (without an explicit <xsl:stylesheet> element).
But in this case you have to use a different name space for literal result
elements <one>, <two>, etc. and for the XSLT elements like
apply-templates.
So a meaningful stylesheet would be:
<root xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<one>
<two>
<xsl:apply-templates select="what to put here if i
want to start from the root//ten">
</two>
...
</one>
<three>
...
<ten> ... </ten>
...
</three>
</root>
In this case you question has still no answer. What I understand is that
you are somehow trying to have a goto behavior. If that is the case, do
not even think about it. Goto is like variable assignement in XSLT: it
does not exist and that IS a feature.
If I still miss the point, could you be more precise about what you is you
data set and what you want to do ?
By the way, you should read a good book on XSLT.
Hope this helps.
-- David --
PS: As far as I know, select="///element... is not legal.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list