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

Re: Node-sets using <xsl:with-param>

Subject: Re: Node-sets using <xsl:with-param>
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 22 Jan 2004 15:40:19 -0500
xsl node param
BINGO! Found it!

At 2004-01-22 14:58 -0500, Mir Farooq Ali wrote:
This is the xml source file on which I'm using the stylesheet
...

Nothing untoward in there, but using that data and adding a single debug statement pointed me to the problem.


Being a second-generation computer programmer (my father started in the trade in 1961, I started programming in 1971), I have long relied on the "printf method of debugging", so I added at the top of the modify template:

<xsl:message><xsl:value-of select="name(.)"/></xsl:message>

At 2004-01-22 12:10 -0500, Mir Farooq Ali wrote:
<xsl:template mode="modify" match="*">
<xsl:param name="id1"></xsl:param>
<xsl:param name="curnode"></xsl:param>
<xsl:variable name="idd" select="translate($id1,' ','_')"></xsl:variable>
<xsl:variable name="newid" select="concat($idd, position())"></xsl:variable>
<part class="{name()}" id="{$newid}">
<xsl:apply-templates mode="modify">
<xsl:with-param name="id1" select="$newid"></xsl:with-param>
</xsl:apply-templates>

The problem is happening the *second* time around because of the above statement. I saw *two* element names exposed before the problem was triggered.


Add <xsl:with-param name="curnode" select="$curnode"/> (or with whatever you need for the argument) to your nested <xsl:apply-templates/> and it will work because you are passing a node for the second invocation.

The first time around, $curnode was just fine ... it was the second time around that you weren't passing a value and the defaulted empty string was being used.

I hope this helps.

........................ Ken


-- Public courses: sign up for one or both soon to reserve your seat! Each week: Monday-Wednesday: XSLT/XPath; Thursday-Friday: XSL-FO Washington, DC: 2004-03-15 San Francisco, CA: 2004-03-22 Hong Kong, China: 2004-05-17 Bremen, Germany: 2004-05-24 World-wide on-site corporate, government & user group XML training

G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Breast Cancer Awareness  http://www.CraneSoftwrights.com/s/bc


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.