[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
RE: [xsl] Error message when match=$variable
Subject: RE: [xsl] Error message when match=$variable From: timw@xxxxxxx Date: Tue, 4 Sep 2001 16:24:04 +1000 |
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()" /> <<xsl:value-of select="$currentname" />><xsl:value-of select="." /></<xsl:value-of select="$currentname" />> <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: [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()" /> > > <<xsl:value-of select="$currentname" />><xsl:value-of > select="." > > /></<xsl:value-of select="$currentname" />> > > </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> > > <<xsl:value-of select="$currentname" />><xsl:value-of > select="." > > /></<xsl:value-of select="$currentname" />> > > <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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Error message when match=, timw | Thread | RE: [xsl] Error message when match=, Jarno . Elovirta |
RE: [xsl] Can FOP output pdf file f, Jarno . Elovirta | Date | RE: [xsl] Can FOP output pdf file f, Ser Siew Keok |
Month |
Keywords