Re: [xsl] Modifying a variable while merging 2 XMLs documents !?

Subject: Re: [xsl] Modifying a variable while merging 2 XMLs documents !?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 16 Mar 2006 16:21:47 GMT
> For that, I used a variable which I change once I copy.

You can not change the value of a variable once it is bound.
    <xsl:variable name="no_value_nl" select="string-length ($value_nl) &lt; 1"/>
..... 
    <xsl:variable name="no_value_nl" select="false"/>
   </xsl:if>

This should generate an error message in xslt1, in xslt2 it's allowed
(but the second is essentially an unrelated variable that happens to
have the same name) The variable goes out of scope immediately at the
</xsl:if> as the scope of a variable in xslt is always the surrounding
element. Also select="false" selects a child <false> element but I
suspect you meant the boolean select="false()"

I think you just want something like

    <xsl:copy>
    <xsl:variable name="value_fr" select="value[@xml:lang='fr']"/>
    <xsl:variable name="value_en" select="value[@xml:lang='en']"/>
    <xsl:apply-templates select="@*|node()"/>
    <xsl:copy-of
    select="self::*[not(value/xml:lang='nl')]/
                  document('glossaryNL.xml')/
                  *[value[@xml:lang='en']=$value_en][value[@xml:lang='fr']=$value_fr]/
                   value[@xml:lang='nl']"/>

     </xsl:copy>

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread