[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: <xsl:if ... question

Subject: Re: <xsl:if ... question
From: "Vasu Chakkera" <vasucv@xxxxxxxxxxx>
Date: Tue, 23 Jul 2002 10:39:40 +0000
if question with xsl
hello brian
to make your XMl well formed,i made the following assumption
1. The root node is called <root>

The way to compare is to use the xsl:key..

the following code will hep you

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key match="/root/resources/resource" name="identifier" use="@identifier"/>
<xsl:template match="/">
<xsl:for-each select="//item">
<xsl:variable name="identifier" select="key('identifier',@identifierref)"/>
<xsl:if test="$identifier">
<a href="{$identifier/@href}"><xsl:value-of select="title"/></a><br/>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>


Vasu

From: Brian Hickey <brian_hickey1@xxxxxxxxx>
Reply-To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
Subject:  <xsl:if ...  question
Date: Tue, 23 Jul 2002 02:53:45 -0700 (PDT)

Hello all

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.
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.

<organizations default="MANIFEST01_ORG1">
 <organization identifier="MANIFEST01_ORG1">
 <item identifier="MANIFEST01_ITEM1" isvisible="true">
  <title>Course Information</title>
 <item identifier="MANIFEST01_ITEM2"
identifierref="MANIFEST01_RESOURCE1" isvisible="1"
parameters="">
  <title>Reading List</title></item>
   </item>
...
</organization>
</organizations>

<resources>
  <resource identifier="MANIFEST01_RESOURCE1"
type="webcontent" href="Geo101_readings.doc">
    <file href="Geo101_readings.doc"/>
  </resource>
...
</resources>

I have made several attempts of solving this in XSL
but without any success. Any help would be
appreciated.

Rgds

Brian
E-mail: Brian_hickey1@xxxxxxxxx


__________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com

XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list




_________________________________________________________________
Join the world?s largest e-mail service with MSN Hotmail. http://www.hotmail.com



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.