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

RE: Error message when match=$variable

Subject: RE: Error message when match=$variable
From: timw@xxxxxxx
Date: Tue, 4 Sep 2001 16:24:04 +1000
xsl variable select gt

concat('$german/',$currentname) didn't turn out to be the saviour I hoped it
would be.

<xsl:value-of select="concat('$german/',$currentname)" /> simple returns the
string rather than the node which the string refers to.

ie.
$german/ld-hello rather than 'Hallo'
or
$german/ld-goodbye rather than 'Lebe wohl'


So I've muddled around with it some more but am unable to find the solution.

I humbly come once again in search of wisdom from the xsl-list.

Tim Watts

<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:choose>
	<xsl:when test="concat('$german/',$currentname)">
		Please Translate
	</xsl:when>
	<xsl:otherwise>
		Already translated to <xsl:value-of
select="concat('$german/',$currentname)" />
	</xsl:otherwise>
</xsl:choose>
</xsl:template>

> -----Original Message-----
> From: timw@xxxxxxx [mailto:timw@xxxxxxx]
> 
> <xsl:when test="concat('$german/',$currentname) != ''">
> 
> > -----Original Message-----
> > From: timw@xxxxxxx [mailto:timw@xxxxxxx]
> > Sent: Tuesday, 4 September 2001 2:52 PM
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: RE:  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
> 

 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.