[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Best way to represent an item and its context?
At 2011-09-15 12:47 -0400, you wrote:
Hi Folks, Fine, so that is your current element. I want to store this element and its context in a variable. The context of author is the entire document. <xsl:variable name="v1" select="."/> Now every time you access $v1 you are "dropped into" the document at the <author> element, right in its context. You say the context is the entire document, so you could go to the top of the document in XSLT 2.0 using: select="$v1/root()" ... or in XSLT 1.0 using: select="$v1/ancestor::node()" So I want a function that takes as input the author element and the Book element and returns a representation of the element and its context: What is your purpose of using a syntactic representation? How do you plan to use that syntactic representation? I have various functions which operate on that Item-in-Context variable. For example, one function returns the item's parent: XPath already has all its useful axis concepts. parent :: Item-in-Context -> Item
Here I invoke the parent function and store the result into a second variable:
It looks a bit like reinventing XPath. Which you can do if you want, but what is it in XPath that prompts you to have an alternate representation? I hope this is considered helpful and not criticizing ... I'm just curious why the existing language features are not meeting your need. . . . . . . . . . . . Ken -- Contact us for world-wide XML consulting and instructor-led training Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Google+ profile: https://plus.google.com/116832879756988317389/about Legal business disclaimers: http://www.CraneSoftwrights.com/legal
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|