[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: backtracking and trying to find a sub-node
Hi Rob,
<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']"/> Just glancing at it, this code looks okay. The values of that 'role' attribute are unique, I take it (or you'd be getting a node set containing more than one node for each of the image.hd1 and image.hd2 attributes). <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"/>" /> The reason this looks so monstrous is that XSLT wasn't designed to work this way. Try something more like: <image src="{$image.hd1/@fileref}" width="{$image.hd1/@width}" height="{$image.hd1/@height}"/> and you'll be much happier. The { } construction is an attribute value template (XSLT 7.6.2), designed for exactly this use case (evaluating expressions to appear in attribute values in literal result elements). How to do this is, actually, a FAQ. I'm not sure this answers exactly the question you asked; but maybe it'll clear things up enough to clarify (please feel free to ask again if not). Good luck, Wendell
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
|