[xsl] Re: Re: Using a variable in XSLT

Subject: [xsl] Re: Re: Using a variable in XSLT
From: Tim Müller-Seydlitz <tms@xxxxxxxxxxxxxxxxxx>
Date: Wed, 03 Sep 2003 09:48:48 +0200
Hi David,
thanks very much. Let me detail my inquiry further.

You can not use variables in match expressions in XSLT 1.

However you appear to be confused:

However xsl:variable is a node set and not a string


Variables may contain either node sets or strings (or other things) but
your variable

<xsl:variable name="SystemSelected" select='"sys:one"' />


contains a string.

Without seeing your source file it's rather hard to guess what your
intended processing is, but possibly something like

<xsl:template match="xs:documentation">
<xsl:choose>
  <xsl:when test="lang('de') and *[name()="$SystemSelected]">
    ....



Actually I would like to process something like this:

	<xs:element name="account" type="Account">
		<xs:annotation>
			<xs:documentation xml:lang="en">This is the English general description
				<sys:one>That's the special purpose description for system 1</sys:one>
				<sys:two>That's the special purpose description for system 2</sys:two>
                       </xs:documentation>
			<xs:documentation xml:lang="de">Das ist die deutsche allgemeneine Beschreibung.
				<sys:one>Das ist die spezielle Beschreibung für System 1</sys:one>
				<sys:two>Das ist die spezielle Beschreibung für System 2</sys:two>			</xs:documentation>
		</xs:annotation>
	</xs:element>

From this structure I want to select the special purpose documentation for system one and later for system two.
As both selection are very similar I would like to use a variable in an XSLT style sheet that lets me either choose sys:one or sys:two.

Regards





XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


Current Thread