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

RE: Parameters in localized messages

Subject: RE: Parameters in localized messages
From: "Jeroen Hellingman" <jeroen@xxxxxxxx>
Date: Tue, 20 Apr 2004 10:44:58 -0400
xls template match
Thanks for the hints!

I think the solution to my problem will be something like:

Having a messages.xml with:

	<message name="msgContact" lang="en">Please contact <param 
name="personalName"/> for details.</message>
	<message name="msgContact" lang="nl">Neem contact op met <param 
name="personalName"/> voor details.</message>

A doc.xml with:


and a xsl stylesheet with:

<xsl:stylesheet version="2.0"

	<xsl:variable name="lang" select="'en'"/>
	<xsl:variable name="messages" select="document

	<!-- THIS REQUIRES XSLT 2.0 -->
	<xsl:template match="content">
		<xsl:variable name="params">
		<xsl:call-template name="formatMessage"/>
			<xls:with-param name="id" select="msgContact"/>
			<xls:with-param name="params" select="$params"/>

	<xsl:template name="formatMessage">
		<xsl:param name="name"/>
		<xsl:param name="params"/>
		<xsl:apply-templates select="$messages/messages/message
[@lang=$lang && @name=$name]" mode="formatMessage">
			<xls:with-param name="params" select="$params"/>

	</xls:template match="param" mode="formatMessage">
		<xsl:param name="params"/>
		<xsl:value-of select="$params/params/param[@name=current

	<xsl:template match="*" mode="formatMessage">
			<xsl:copy-of select="@*"/>
			<xsl:apply-templates mode="formatMessage"/>



Current Thread


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.
First Name
Last Name
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.