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


> When I run the following stylesheet with
> <xsl:template match="$english/node()">,
> which should display all the nodes of the english.xml, I get an error

A variableReference cannot be used in a Pattern

> 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>

You're not looking for the document URL from the english.xml child of
language child, but rather from a relative URL languages/english.xml, so the
expression inside document() should be in quotes

> <xsl:variable name="german"
> select="document(languages/german.xml)/language"></xsl:variable>

Same here

> <xsl:template match="/">
> <html>
> <head>
> </head>
> <body>
> 	<textarea rows="20" cols="100">
> 	<xsl:apply-templates select="$english/node()" />

You don't want to process the whitespace, so use $english/* 

> 	</textarea>
> </body>
> </html>
> </xsl:template>
> 
> <xsl:template match="$english/node()">

Just node() or * will do

> <xsl:value-of select="name()" /> = <xsl:value-of select="." />&#10;

The &#10; as such will be removed by the XSLT engine during whitespace
stripping, so wrap it into xsl:text

> </xsl:template>
> 
> </xsl:stylesheet>

Jarno

 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]