[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Using absolute path when context item is an atomic

Subject: Re: Using absolute path when context item is an atomic value xslt 2.0
From: Colin Paul Adams <colin@xxxxxxxxxxxxxxxxxx>
Date: 18 Oct 2005 17:13:11 +0100
colin path
>>>>> "andrew" == andrew welch <andrew.j.welch@xxxxxxxxx> writes:

    andrew> Ok.... but when you do:

    andrew> <xsl:for-each select="1 to 10">

    andrew> The "context node" is an atomic value - how do you
    andrew> anything useful here?  Do you need to do:

    andrew> <xsl:variable name="currentElem" select="."/>
    andrew> <xsl:for-each select="1 to 10"> <xsl:value-of
    andrew> select="$currentElem/whatever"/>

Something like that. You might set a variable
named root to point to the document you are interested in, then you
could use expressions such as $root/path/from/root 

    andrew> This seems cumbersome, so I'm probably not using "1 to 10"
    andrew> in the correct way.

It depends upon what you are trying to do. As far as I can see, your
[.] could be replaced by [position < 11], and then you wouldn't need
the 1 to 10 at all.
But maybe I'm misunderstanding your intention.

    andrew> Actually, I can't see why '/' would ever select anything
    andrew> when the context item is an atomic value, so why doesn't
    andrew> it keep it's pointer to the original root.

Suppose there WASN'T an original root? There is no requirement in XSLT
2.0 for there ever to be a document root.
How do you define "original"?
-- 
Colin Adams
Preston Lancashire

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.