[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: trying to set a parameter equal to an elements att
Well, actually there are even more issues with the example: <header volume="8"/> <xsl:param name="vol"> <xsl:value-of select="header[@volume]"/> </xsl:param> OK, first of all in a simple case like this, you probably don't want an RTF, although it'd work... So the first step is to add a select: <xsl:param name="vol" select="header[@volume]"/> The second issue is in the XPath... note that the end result of the above XPath is a _header_ node (header[@volume] means all header nodes which have a volume attribute), not the volume attribute. Therefore, when you use it as a number, it's going to take the text content of the header element, which is empty. What you probably intend is: <xsl:param name="vol" select="header/@volume"/> In this case, you're going to assign the volume attribute to the variable. As a matter of preference, since you're using this as a numeric value, I'd go ahead and case it: <xsl:param name="vol" select="number(header/@volume)"/> Because of the semantics of nodesets in different places, this can sometimes keep you out of trouble. HTH! Dion -----Original Message----- From: Noel Golding [mailto:noel@xxxxxxxxxxxxxxx] Sent: Wednesday, August 21, 2002 2:39 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: trying to set a parameter equal to an elements attribute even with the namespace it still does not retrieve the value. ----- Original Message ----- From: <sara.mitchell@xxxxxxxxx> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Sent: Wednesday, August 21, 2002 5:03 PM Subject: RE: trying to set a parameter equal to an elements attribute > Well, every XSLT engine that I'm familiar with requires > a valid namespace for XSLT in the stylesheet element. So > > > > <xsl:stylesheet version="1.0" xmlns:xsl=""> > > should be > > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> > > Sara > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list 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
|