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]

RE: Error message when match=$variable


Duh...

I just changed it to a string using

<xsl:when test="concat('$german/',$currentname) != ''">

and the error stopped.

Thanks anyway,

Tim Watts

> -----Original Message-----
> From: timw@3d3.com [mailto:timw@3d3.com]
> Sent: Tuesday, 4 September 2001 2:52 PM
> To: xsl-list@lists.mulberrytech.com
> Subject: RE: [xsl] Error message when match=$variable
> 
> 
> Thank you Jarno,
> 
> I've amended my xsl and that part is now working. (the new 
> code is given
> below)
> 
> Now I've just got to do a test for $german nodes with the 
> same node name()
> as in the $english node, so that my translator can do the 
> translations which
> are required without re-doing already translated nodes.
> 
> I tried adding this code
> <xsl:choose>
> 	<xsl:when test="$german/string($currentname) != ''">
> 		<!--xsl:value-of 
> select="$german/string($currentname") /-->
> (Already translated)
> 	</xsl:when>
> 	<xsl:otherwise>Please translate</xsl:otherwise>
> </xsl:choose>
> to the template
> <xsl:template match="*">
> <xsl:variable name="currentname" select="name()" />
> &lt;<xsl:value-of select="$currentname" />&gt;<xsl:value-of select="."
> />&lt;/<xsl:value-of select="$currentname" />&gt
> </xsl:template>
> but I am now getting a error.
> 
> Error [code:201] [URI:file:/home/data/complang.xsl] [line:23]
> [node:attribute 'test']
>   wrong expression syntax
> 
> I had guessed that an X-path cannot accept the syntax with 
> two node-set
> variables, so I converted $currentname to a string(as that is 
> how I want it
> used).
> 
> Can anyone shed any light on how to get around this problem?
> 
> Cheers, Tim
> 
> XSL:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> 
> <xsl:variable name="english"
> select="document('languages/english.xml')/language"></xsl:variable>
> <xsl:variable name="german"
> select="document('languages/german.xml')/language"></xsl:variable>
> 
> <xsl:template match="/">
> <html>
> <head>
> </head>
> <body>
> 	<textarea rows="20" cols="100">
> 	<xsl:apply-templates select="$english/*" />
> 	</textarea>
> </body>
> </html>
> </xsl:template>
> 
> <xsl:template match="*">
> <xsl:variable name="currentname"><xsl:value-of select="name()"
> /></xsl:variable>
> &lt;<xsl:value-of select="$currentname" />&gt;<xsl:value-of select="."
> />&lt;/<xsl:value-of select="$currentname" />&gt;
> <xsl:choose>
> 	<xsl:when test="$german/string($currentname) != ''">
> 		<!--xsl:value-of 
> select="$german/string($currentname)" /-->
> (Already translated)
> 	</xsl:when>
> 	<xsl:otherwise>Please translate</xsl:otherwise>
> </xsl:choose>
> </xsl:template>
> 
> </xsl:stylesheet>> 

 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]