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

backtracking and trying to find a sub-node

Subject: backtracking and trying to find a sub-node
From: Robert Koberg <rob@xxxxxxxxxx>
Date: Tue, 21 Nov 2000 12:23:05 -0800
xsl value of subnode
Hi,

Could you look at the below and offer some advice on how it should be done.
Firs there is an sample of XML followed by my attempt at XSL. I have an XML
structure that looks like this:

<config>
  <section>
     <image attributes.../>
     <image attributes.../>
        <section><page/></section>
        <section>
          <page/>
          <section>
            <page/>
            <section><page/></section>
          </section>
        </section>
  </section>

  <section>
     <image attributes.../>
     <image attributes.../>
        <section><page/></section>
        <section>
          <page/>
          <section>
            <page/>
            <section><page/></section>
          </section>
        </section>
  </section>
</config>

The Problem: I need to access the images at the 1st section no matter which
sub-section I am in.  In other words the images at the top level need to
cascade down through the other sections. This is what I have been trying:

<xsl:variable name="images" select="ancestor::section//image"/>
   <xsl:variable name="image.hd1" select="$images[@role='hd1']"/>
   <xsl:variable name="image.hd2" select="$images[@role='hd2']"/>

   &lt;image src="<xsl:value-of select="$image.hd1/@fileref"/>"
width="<xsl:value-of select="$image.hd1/@width"/>" height="<xsl:value-of
select="$image.hd1/@height"/>" /&gt;

  &lt;image src="<xsl:value-of select="$image.hd2/@fileref"/>"
width="<xsl:value-of select="$image.hd2/@width"/>" height="<xsl:value-of
select="$image.hd2/@height"/>" /&gt;
</xsl:template>

tia, Rob


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


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.