[Home] [By Thread] [By Date] [Recent Entries]
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
|

Cart



