This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Change the value of a parameter in a template
- To: xsl-list at mulberrytech dot com
- Subject: Change the value of a parameter in a template
- From: fredric larsson <fredric dot larsson at exertus dot se>
- Date: Mon, 13 Nov 2000 16:52:14 +0100
- Cc: mikael granhed <mikael dot granhed at exertus dot se>
- Reply-To: xsl-list at mulberrytech dot com
Hi.
I have got the same problem as Laurent has in his mail dated 6 Nov 2000
08:46:48 +0000 from e-mail address: "Ext.ZXSPRCR2A015@tls.mms.fr".
Here is my problem:
I want to compare XML-data with a value of a parameter in my XSL-stylesheet.
XML-data looks like this:
<wc:INSTANCE CLASS="Rel">
<Left>id11</Left>
<Right>id12</Right>
<OBID>id1</OBID>
</wc:INSTANCE>
<wc:INSTANCE CLASS="Rel">
<Left>id21</Left>
<Right>id22</Right>
<OBID>id2</OBID>
</wc:INSTANCE>
I've got a template, called "Relation", with two parameters:
<xsl:param name="article" select='OBID'/>
<xsl:param name="find"/>
I call a new template called "findRelation" and apply the parameters:
<xsl:call-template name="findRelation">
<xsl:with-param name="article" select="$article"/>
<xsl:with-param name="find" select="$find"/>
</xsl:call-template>
In the template "findRelation" I compare the parameter "article" with the
XML-data in a loop ("for-each").
When an element, <Left>, is equal to the parameter "article" I store the
<Right> element in the parameter "find ":
<xsl:template name="findRelation">
<xsl:param name="article"/>
<xsl:param name="find"/>
<xsl:for-each select="//wc:INSTANCE">
<xsl:if test="Left=$article">
<xsl:param name="find" select='Right'/>
</xsl:if>
</xsl:for-each>
</xsl:template>
Then I want to access the parameter "find", with its new value, from the
calling template "Relation".
Does anybody know how to do that?
Regards
Fredric
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list