[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Display the first NodeList Values

Subject: RE: Display the first NodeList Values
From: Jarno.Elovirta@xxxxxxxxx
Date: Thu, 30 Jan 2003 10:45:38 +0200
nodelist text
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@xxxxxxxxx]
> Sent: 30 January, 2003 10:24
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: RE:  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.Elovirta@xxxxxxxxx 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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.