| Subject: [xsl] Best way to represent an item and its context? From: "Costello, Roger L." <costello@xxxxxxxxx> Date: Thu, 15 Sep 2011 12:47:55 -0400 | 
Hi Folks,
Consider this XML document:
<?xml version="1.0"?>
<Book>
      <title>GML</title>
      <author>Ron Lake</author>
      <date>2004</date>
</Book>
Suppose that while processing that XML document I get to the author element:
      <author>Ron Lake</author>
I want to store this element and its context in a variable. The context of
author is the entire document.
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:
item-in-context :: Item -> Context -> Item-in-Context
Read as: "The function item-in-context has two arguments -- an item (element)
and a context -- and it returns a representation of the element and its
context."
Here I invoke that function and store the result into a variable:
<xsl:template match="/">
      <xsl:variable name="v1" select="f:item-in-context(Book/author, Book)"
/>
</xsl:template>
I have various functions which operate on that Item-in-Context variable. For
example, one function returns the item's parent:
parent :: Item-in-Context -> Item
Here I invoke the parent function and store the result into a second
variable:
<xsl:template match="/">
      <xsl:variable name="v1" select="f:item-in-context(Book/author, Book)"
/>
      <xsl:variable name="v2" select="f:parent($v1)" />
</xsl:template>
What's the best way to represent an item and its context?
/Roger
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| Re: [xsl] Displaying Icon in Page M, Tony Graham | Thread | Re: [xsl] Best way to represent an , G. Ken Holman | 
| Re: [xsl] Displaying Icon in Page M, G. Ken Holman | Date | Re: [xsl] Best way to represent an , G. Ken Holman | 
| Month |