xsl-list
[Top] [All Lists]

How a node value of an external xml file?

2002-10-11 03:48:00
I have 3 files Address.xml (mainfile with address data), Address.xsl (transformation of the mainfile) and translations.xml (file I want to use to do translations). Problem is that I want to get translated data from my external file (translations.xml) in my xsl. I want to do this by passing the founded parameters (txtNode & txtLang), but that didn't work.
(cfr. <xsl:value-of select="$resource/$txtNode/$txtLang"/>)
When I pass my values without parameters it works! (cfr. <xsl:value-of select="$resource/AddressTitle/EN"/>)

How can I pass my parameters to get the correct node value of my file Translations.xml ???

Thanx in advance.


== Address.xsl ==
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:fo="http://www.w3.org/1999/XSL/Format";>
        <xsl:output method="xml"/>
        <xsl:variable name="resource" select="document('Translations.xml')"/>
        ....
        <xsl:template name="Address">
                <Line bold="true" dhigh="false" justify="left">
<xsl:call-template name="Resource"><xsl:with-param name="txtNode">AddressTitle</xsl:with-param></xsl:call-template>
                </Line>
        </xsl:template>

        <xsl:template name="Resource">
                <xsl:param name="txtNode"/>
                <xsl:param name="txtLang">EN</xsl:param>
                <xsl:value-of select="$resource/$txtNode/$txtLang"/>
        </xsl:template>
        ....
</xsl:stylesheet>

== Translations.xml ==
<?xml version="1.0" encoding="UTF-8"?>
<Resource>
        <AddressTitle>
                <EN>Customer: </EN>
                <NL>Klant: </NL>
                <FR>Client: </FR>
        </AddressTitle>
</Resource>

_________________________________________________________________
Join the world?s largest e-mail service with MSN Hotmail. http://www.hotmail.com


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



<Prev in Thread] Current Thread [Next in Thread>