[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] backtracking and trying to find a sub-node
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|