This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: xsl: using attribute value in apply-templates select
- From: Joerg Heinicke <joerg dot heinicke at gmx dot de>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Fri, 07 Jun 2002 20:13:25 +0200
- Subject: Re: [xsl] xsl: using attribute value in apply-templates select
- References: <F58kpLkTgbLYluLCTao00019838@hotmail.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hello Alex,
I don't understand exactly what you want, but I assume the "mode" can
help you. So you can have a template
<xsl:template match="node" mode="foo"/>
and a template
<xsl:template match="node" mode="bar"/>
So if you do an <xsl:apply-templates/> you can add a mode too:
<xsl:apply-templates select="node" mode="foo"/>
and on another place
<xsl:apply-templates select="node" mode="bar"/>
Does this solve your problem?
Joerg
Alex Reuter wrote:
Hi,
I ended up using this:
<xsl:apply-templates select="descendant::*[@key='key.string.1']"/>
Interestingly when using Saxon 7 I get this warning message:
Recoverable error
Ambiguous rule match for /page[1]/collection[1]
Matches both "collection" on line 3 of file:/C:/1_template.xsl
and "collection" on line 3 of file:/C:/2_template.xsl
I have 2 templates which both match the collection node set, and I need
them to be generic user interface templates. To populate a drop-down
list for example, or to fill in a textarea. Does anyone have any tips
for a better way to perhaps organize the data or make the template
match's more specific but still generic?
Thanks,
Alex
From: "Alex Reuter" <xslalex@hotmail.com>
Reply-To: xsl-list@lists.mulberrytech.com
To: XSL-List@lists.mulberrytech.com
Subject: [xsl] xsl: using attribute value in apply-templates select
Date: Fri, 07 Jun 2002 15:05:26 +0000
Hello List,
I have an xml document filled with key-value pairs that the xsl needs
to use
to identify the proper nodes to process in the proper templates.
Given an xml like this:
<page>
<collection key="key.string.1">
<data>stuff</data>
<data>stuff</data>
</collection>
<collection key="key.string.2">
<data>stuff</data>
<data>stuff</data>
</collection>
</page>
And a template like this:
<xsl:template match="collection">
stuff...
</xsl:template
How would I write the select attribute of
<xsl:apply-templates select=" ? "/>
To properly select the collection node whose key attribute is equal to
key.string.1?
Thanks for any help on this,
Alex
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list