[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: <xsl:if ... question
Hi Brian, > Basically I want to test if the value of the > identifierref attribute in the item element, is equal > to the identifier attribute, in the resource element. Presumably there might be a lot of resource elements with different identifiers? If so, it's probably easiest to create a key that indexes the resource elements by their identifiers as follows: <xsl:key name="resources" match="resource" use="@identifier" /> You can then get a particular resource based on its identifier with: key('resources', $identifier) So, for example, if you're on an item element at the moment, you can get the resource referenced by that item element's identifierref attribute using: key('resources', @identifierref) I'd store that resource in a variable and then test whether the variable contains anything: <xsl:template match="item"> <xsl:variable name="resource" select="key('resources', @identifierref)" /> <xsl:if test="$resource"> ... </xsl:if> </xsl:template> > If so, then I want to take the value of the href attribute from the > resource element and use it to create a link in my html document, > along with the content of the title element, which will be the name > of the link. You should find this easy enough. The resource element's href attribute can be accessed with $resource/@href. Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ 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
|