This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: getting an attribute value through <apply-templates/>
- From: Jeni Tennison <jeni at jenitennison dot com>
- To: owner-xsl-list at lists dot mulberrytech dot com, "CROFT, MICHAEL" <MCROFT at amica dot com>
- Cc: "'xsl-list at lists dot mulberrytech dot com'" <xsl-list at lists dot mulberrytech dot com>
- Date: Mon, 10 Jun 2002 15:38:35 +0100
- Subject: Re: [xsl] getting an attribute value through <apply-templates/>
- Organization: Jeni Tennison Consulting Ltd
- References: <CF698667C737D41198E50060943F3CF6F68244@hoexch03.amica.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Michael,
> For some reason, I still cant get the ID? Here are the xml/xsl
> excerpts:
[snip]
> <xsl:template match="InsClaimsContact">
> <xsl:call-template name="PartyGenInfo"/>
> <xsl:call-template name="InjuryDetails"/>
> <xsl:call-template name="VehicleInfo">
> <xsl:with-param name="id" select="@id"/>
> </xsl:call-template>
> </xsl:template>
[snip]
> <InsClaimsContact Id="1-16HHT">
XML is case sensitive. In your XML, InsClaimsContact's Id attribute
has a capital 'I'; in your call to the VehicleInfo template,
you're trying to select an id attribute (small i) instead. Try:
<xsl:call-template name="VehicleInfo">
<xsl:with-param name="id" select="@Id" />
</xsl:call-template>
[I'd use moded templates here instead; do:
<xsl:apply-templates select="." mode="VehicleInfo" />
and then have:
<xsl:template match="InsClaimsContact" mode="VehicleInfo">
<b>---Vehicle Details---</b>
CLAIM ID IS: <xsl:value-of select="@Id"/>
</xsl:template>
but that's just a personal preference.]
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list