Re: Other transformations

Subject: Re: Other transformations
From: James Clark <jjc@xxxxxxxxxx>
Date: Wed, 16 Dec 1998 16:56:56 +0700
This is a much more interesting problem.  If isbn was an ID attribute,
then you could just use select="id(@isbn)".  See

  http://www.w3.org/TandS/QL/QL98/pp/microsoft-extensions.html

for some possible ways of extending XSL to cover this.

James Roberge wrote:
> 
> 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


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


Current Thread