This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: getting an attribute value through <apply-templates/>


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]