RE: [xsl] Using xsl to test value of node

Subject: RE: [xsl] Using xsl to test value of node
From: "Chris Bayes" <chris@xxxxxxxxxxx>
Date: Thu, 13 Dec 2001 16:14:19 -0000
<xsl:template match ="CHARACTER_ID">
    <xsl:if test=".=44639"/>  
    <xsl:apply-templates select="../LOCATION_ID"/> 
</xsl:if> *here*
</xsl:template>
Yes. If you look at the indentation you will see that </xsl:if> is
closing the <xsl:template element. Chrange
<xsl:if test=".=44639"/> to <xsl:if test=".=44639">
And it looks like
<xsl:template match ="CHARACTER_ID">
    <xsl:if test=".=44639">  
        <xsl:apply-templates select="../LOCATION_ID"/> 
    </xsl:if>
</xsl:template>
But you still need <xsl:if test="normalize-space()=44639">

Ciao Chris

XML/XSL Portal
http://www.bayes.co.uk/xml


> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Ahmad J Reeves
> Sent: 13 December 2001 15:52
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Cc: Ahmad Reeves
> Subject: Re: [xsl] Using xsl to test value of node
> 
> 
> Hi David,
> 
> Many thanks for your help, that makes much more sense now.
> The parser still throws up the following error:
> 
> "The element type "xsl:template" must be terminated by the 
> matching end tag </xsl:template>" at the following position
> 
> <xsl:stylesheet
>         xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>         version="1.0">
>  <xsl:output method="html"/>
> 
>  <xsl:template match="LOG">
>         <xsl:apply-templates select="DIRECT"/>
>  </xsl:template>
> 
>  <xsl:template match="DIRECT">
>         <xsl:apply-templates select="CHARACTER_ID"/>  </xsl:template>
> 
>  <xsl:template match ="CHARACTER_ID">
>     <xsl:if test=".=44639"/>  
>     <xsl:apply-templates select="../LOCATION_ID"/> 
>     </xsl:if> *here*
>  </xsl:template>
> 
>  <xsl:template name="LOCATION_ID">
>   <html>
>     <body>
>       <h1>
>         <xsl:value-of select="."/>
>       </h1>      
>     </body>
>  </html>
>  </xsl:template>    
> 
> </xsl:stylesheet> 
> 
> Its as if it can't see the </xsl:template> tag underneath.
> Am I missing something blatant! Probably!!
> 
> Cheers again
> Ahmad
> 
> 
> David Carlisle wrote:
> > 
> >     <xsl:if test() ="44639"/>
> > XSL stylesheets have to be XML XML attribute names  can't 
> include () 
> > so this won't get past the XML parser, so the xslt engine won't see 
> > the stylesheet. You want
> >     <xsl:if test=".=44639"/>
> > 
> >     <xsl:Xpply-templates select="LOCATION_ID"/>
> > in that template the current node is CHARACTER_ID so the 
> above XPath 
> > would select LOCATION_ID children of CHARACTER_ID nodes, 
> but there are 
> > not any, you want
> >     <xsl:Xpply-templates select="../LOCATION_ID"/>
> > 
> > David
> > 
> > 
> _____________________________________________________________________
> > This message has been checked for all known viruses by Star 
> Internet 
> > delivered through the MessageLabs Virus Scanning Service. 
> For further 
> > information visit http://www.star.net.uk/stats.asp or alternatively 
> > call Star Internet for details on the Virus Scanning Service.
> > 
> >  XSL-List info and archive:  
> http://www.mulberrytech.com/xsl/xsl-list
> 
> -- 
> 
> -----------------------------------------------------
> Ahmad J. Reeves BSc(Hons), MSc(Dist). Phd Student
> Information, Media, and Communication Research Group,
> Dept of Computer Science,Queen Mary,University of London, 
> E1 4NS Tel +44 (0)20 7882 5257
> http://www.dcs.qmw.ac.uk/imc/
> -----------------------------------------------------
> 
>  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