|
Subject: Re: [xsl] variable outside a for-each loop From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Thu, 20 Sep 2007 09:27:36 -0400 |
I have the following XML (docbook): ... My goal is to produce:
<table> <entry one="ABC" two="DEF"/> <entry one="ABC" two="DEF 2"/> </table>
In C/C++ this is trivial at each step whenever row/entry is empty I would use some local variable instead. But in XSL I am stuck with:
<xsl:for-each select="row"> <xsl:variable name="one" select="normalize-space(string-join(entry[1]/para,' '))"/> <xsl:variable name="two" select="normalize-space(string-join(entry[2]/para,' '))"/> <entry one="{$one}" two="{$two}"/> </xsl:for-each>
Could someone please let me know what the correct solution is when using XSL ?
<xsl:for-each select="row">
<entry one="{normalize-space(string-join(entry[1]/para,' '))}"
two="{normalize-space(string-join(entry[2]/para,' '))}"/>
</xsl:for-each>
-- Upcoming public training: UBL and code lists Oct 1/5; Madrid Spain World-wide corporate, govt. & user group XML, XSL and UBL training RSS feeds: publicly-available developer resources and 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 Cancer Awareness Jul'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] variable outside a for-each l, Mathieu Malaterre | Thread | Re: [xsl] variable outside a for-ea, Abel Braaksma |
| [xsl] variable outside a for-each l, Mathieu Malaterre | Date | RE: [xsl] variable outside a for-ea, cknell |
| Month |