|
Subject: backtracking and trying to find a sub-node From: Robert Koberg <rob@xxxxxxxxxx> Date: Tue, 21 Nov 2000 12:23:05 -0800 |
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']"/>
<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"/>" />
<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"/>" />
</xsl:template>
tia, Rob
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: my first question !, Jeni Tennison | Thread | Re: backtracking and trying to find, Wendell Piez |
| Re: Call for Implementation: XSL 1., Sebastian Rahtz | Date | Re: Changing a xsl:param value from, Dimitre Novatchev |
| Month |