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

Re: URL parameters in xsl

Subject: Re: URL parameters in xsl
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 22 May 2003 11:18:53 +0100
xsl value of select url
aside from any other problems, your code will always generate a (recoverable)
error if there is more than one chapter:

<div class="menu" ><xsl:for-each select="CHAPTER"> 
                        <xsl:attribute name="id"><xsl:value-of select="PARENTNAME"/>Menu</xsl:attribute> 
                        <div class="menuNode"><a ><xsl:attribute
                        name="href">default.asp?id=<xsl:value-of
 select="ID"/>%26parent=<xsl:value-of
                        select="PARENTNAME"/>%26size=<xsl:value-of
 select="SIZE"/>%26description=<xsl:value-of select="DESCRIPTION"/></xsl:attribute><xsl:value-of 
select="NAME" /></a> </div>
                        </xsl:for-each> </div></td>
                  </tr>
                </table>
                </xsl:for-each> </div>

For the first CHAPTER it will add an id attribute to the <div
class="menu" > element, then add a  <div class="menuNode"> child.

Then for the second CHAPTER it will attempt to (re) add the id attribute
to <div class="menu" > but this is an error as you can not add
attributes after  element nodes. I don't know what the code's trying to
do so can't suggest a fix.

Note however that as you are not generating the attribute names
dynamically you don't need all the <xsl:value-of and <xsl:attribute
complication.

<a ><xsl:attribute
                        name="href">default.asp?id=<xsl:value-of
 select="ID"/>%26parent=<xsl:value-of
                        select="PARENTNAME"/>%26size=<xsl:value-of
 select="SIZE"/>%26description=<xsl:value-of select="DESCRIPTION"/></xsl:attribute><xsl:value-of 
select="NAME" /></a>

is just a long way of writing

<a href=
"default.asp?id={ID}%26parent={PARENTNAME}%26size={SIZE}%26description={DESCRIPTION}">
  <xsl:value-of select="NAME" />
</a>

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

 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.