Right, then change your stylesheet to
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="/">
<xsl:variable name="IdType"
select="AdditionalIdList/AdditionalId[1]/IdTypeCode"/>
<xsl:variable name="IdNumber"
select="AdditionalIdList/AdditionalId[1]/IdNumber"/>
<xsl:if test="$IdType='DLIC'">
<xsl:text>Driver's license no. </xsl:text>
<xsl:value-of select="$IdNumber"/>
<xsl:text> State </xsl:text>
<xsl:value-of
select="//AdditionalIdList/AdditionalId[1]/IdIssuer"/>
</xsl:if>
<xsl:if test="$IdType='PASP'">
<xsl:text>Passport no. </xsl:text>
<xsl:value-of select="$IdNumber"/>
</xsl:if>
<xsl:if test="$IdType='PSWD'">
<xsl:text>Password </xsl:text>
<xsl:value-of select="$IdNumber"/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
I.e. add the positional predicates, but what you *really* want is
<xsl:template match="/">
<xsl:apply-templates select="AdditionalIdList/AdditionalId[1]" />
</xsl:template>
<xsl:template match="AdditionalId[IdTypeCode = 'DLIC']">
<xsl:text>Driver's license no. </xsl:text>
<xsl:value-of select="IdNumber"/>
<xsl:text> State </xsl:text>
<xsl:value-of select="IdIssuer"/>
</xsl:template>
<xsl:template match="AdditionalId[IdTypeCode = 'PASP']">
<xsl:text>Passport no. </xsl:text>
<xsl:value-of select="IdNumber"/>
</xsl:template>
<xsl:template match="AdditionalId[IdTypeCode = 'PSWD']">
<xsl:text>Password </xsl:text>
<xsl:value-of select="IdNumber"/>
</xsl:template>
The functionality is the same, but the it's cleaner as as a stylesheet.
Cheers,
Jarno - Hocico: Starving Children
-----Original Message-----
From: ext Nischal Muthana [mailto:nischal_muthana(_at_)yahoo(_dot_)com]
Sent: 30 January, 2003 10:24
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Display the first NodeList Values
Hi Jarno,
When I use the xsl below I get the output as
Driver's license no. 34342332 State CAPassport no.
34342332Password 34342332
Instead of just
Driver's license no. 34342332 State CA
Thanks for your time
Nischal
--- Jarno(_dot_)Elovirta(_at_)nokia(_dot_)com wrote:
Hi,
Here is my question. I have this xml I want to
take
the first nodelist AdditionalId and display each
of
the value based on a code check.
Do you mean you want to process the first
AdditionalId in the document, and display it? Your
stylesheet already processes the first AdditionalId,
so what is the problem? Could you show us your
desired output and explain where you're having
problems in writing a stylesheet for it.
Cheers,
Jarno - God Module: Interference
XSL-List info and archive:
http://www.mulberrytech.com/xsl/xsl-list
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list