Subject: Re: [xsl] problem with an xml/xsl transformation From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Mon, 05 Apr 2004 12:19:51 -0400 |
Here's my input xml: ... <ClaimsPartyInfo>
<ClaimsPartyRoleCd>VEH</ClaimsPartyRoleCd>
<ClaimsPartyRoleCd>DRV</ClaimsPartyRoleCd>
<ClaimsPartyLocCd>INSVEH</ClaimsPartyLocCd>
...
and my xsl:
...
<xsl:template match="ClaimsSvcRq/ClaimsNotificationAddRq/ClaimsParty/ClaimsPartyInfo[descendant::ClaimsPartyRoleCd='VEH' and descendant::ClaimsPartyLocCd='INSVEH']">
<xsl:element name="OwnerName">
<xsl:call-template name="GetName"/>
</xsl:element>
</xsl:template>
<xsl:template match="ClaimsSvcRq/ClaimsNotificationAddRq/ClaimsParty/ClaimsPartyInfo[descendant::ClaimsPartyRoleCd='DRV' and descendant::ClaimsPartyLocCd='INSVEH']">
<xsl:element name="DriverName">
<xsl:call-template name="GetName"/>
</xsl:element>
</xsl:template>
what the transform looks like:
<?xml version="1.0" encoding="UTF-8"?> <UdtFNOLArray> <VehicleData> <DriverName>C J Pounder III & Brock Pounde</DriverName> <DriverName>C J Pounder III & Brock Pounde</DriverName> </VehicleData> </UdtFNOLArray>
and what it should look like:
<?xml version="1.0" encoding="UTF-8"?> <UdtFNOLArray> <VehicleData> <OwnerName>C J Pounder III & Brock Pounde</DriverName> <DriverName>C J Pounder III & Brock Pounde</DriverName> </VehicleData> </UdtFNOLArray>
The Driver element gets repeated.
If I switch locations of the Owner and Driver xsl sections, the Owner gets repeated. I'm thinking this is do to similar templates having only the "descendant::ClaimsPartyRoleCd='VEH'" being different and the last one "wins".
But I'm having difficulty coming up with a different method that works.
<xsl:template match="ClaimsPartyInfo" mode="do-owner-stuff"> ... </xsl:template>
<xsl:template match="ClaimsPartyInfo" mode="do-driver-stuff"> ... </xsl:template> ... <xsl:apply-templates mode="do-owner-stuff" select="..."/> <xsl:apply-templates mode="do-driver-stuff" select="..."/>
-- Public courses: Spring 2004 world tour of hands-on XSL instruction Each week: Monday-Wednesday: XSLT/XPath; Thursday-Friday: XSL-FO Hong Kong May 17-21; Bremen Germany May 24-28; Helsinki June 14-18
World-wide on-site corporate, govt. & user group XML/XSL 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 Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] problem with an xml/xsl trans, Gary Fix | Thread | RE: [xsl] problem with an xml/xsl t, Gary Fix |
[xsl] xerces2 Element type "xsl:sty, Othman HADDAD | Date | RE: [xsl] creating multiple namespa, Michael Kay |
Month |