Other transformations

Subject: Other transformations
From: "James Roberge" <jroberge@xxxxxxxxxxxxx>
Date: Tue, 15 Dec 1998 10:18:08 -0600
Alternating row tags seems to have sparked a fair amount of discussion. I
suspect that bigger problem is presented by the apparent inability to pair
items in different subtrees. To give a contrived example, suppose that I'm
using XML to transmit data about bookstore.

<store id="1">
     <book isbn="123"/>
     <book isbn="234"/>
     <book isbn="345"/>
     ...
</store>
... more stores ...
<bookRef isbn="123'>
   <title>...</title>
  <author>...</author>
</bookRef>
... more book refs ...

Ignoring for the moment the fact that this is a hideous use of attributes,
suppose that when I'm processing a store's books, I'd like to display the
titles for each book. To get the title, I need to be able to associate a
<book> element with the associated <bookRef> element based on their isbn
attribute -- something akin to

    <xsl:value-of  select="bookRef/[@id=this/@id]"/>

using the MS XSL style syntax where the "this" reference has its C++
meaning.  I don't see how this type of reference can be done with the WD XSL
or with MS XSL pattern-matching syntax.

Alternatively, I could instantiate all the <book> elements prior to serving
the XML, but that means I need to construct an  XML representation based on
presentation to a user rather than the natural content structure -- equally
important, I cannot construct this instantiated XML representation using XSL
but must use the DOM.. Just as a point of reference, I've come across the
need for this type of reference several times in the past few months as
we've started using XSL to create XML and HTML representations of data
coming from a variety of data sources.

Am I incorrect in assuming that this style of reference cannot be done? Are
there plans afoot to provide the ability to reference the current element's
attributes (and members) within select/match patterns?

- Jim Roberge'





 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread