xml editor

Supported platforms

Compatible with Windows7 & Mac OS X Snow Leopard

Ready for data server software
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] fallback parameter


Subject: Re: [xsl] fallback parameter
From: J-P S <jps@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 23 Sep 2004 08:50:06 +0100 (BST)

On Wed, 22 Sep 2004, Jan Limpens wrote:

) In my xml I have areas marked with lang='somelanguage'. In my xslt I
) defined a parameter selectedLanguage (can be changed by user input)
) and a parameter defaultLanguage, that is used, when no content in the
) selected Language is available.

Can't you just work with the one variable $somelanguage (capital l?)
throughout? If you define somelanguage at the top of the stylesheet:

	<xsl:stylesheet ... >
	   <xsl:param name="somelanguage" select="'en'"/>

	   <xsl:template match="/">
	     Foo: <xsl:value-of select="$somelanguage"/>
	   </xsl:template>
	</xsl:stylesheet>

NOTE: double quotes around "'en'", otherwise it will take the value of the
ELEMENT en, which doesn't exist. Then specifying it on the command line to
e.g. saxon should cause it to be overridden e.g:

	> saxon test.xsl test.xsl
	Foo: en

	> saxon test.xsl test.xsl somelanguage=Spanish
	Foo: Spanish

Cheers,
J-P
-- 
It is redundant to punish a girl who dyes her hair multiple colors.
But if you feel it's absolutely necessary, I recommend a tattoo.


Current Thread
Keywords
XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2011 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>®XML Editor