L Duperval <duperval <at> videotron.com> writes:
> The value of attr2 is pushed up to the <file> element and the value of id is
> used as a parameter to the <redirect:write> rule.
> 
> L
> 
> 

OK, I managed to do what I wanted, although I am cheating a bit...

  <xsl:template match="DATAFILE">
    <DATAFILE LANG="en">
      <xsl:for-each select="SITE">
        <xsl:variable name="filename"
          select="concat('output/',@LOCATIONID,'.xml')" />
        <redirect:write select="$filename" indent="yes">
          <xsl:copy>
            <xsl:value-of select="*" />

            <xsl:apply-templates select="@*|node()" />
          </xsl:copy>
        </redirect:write>
      </xsl:for-each>
    </DATAFILE>
  </xsl:template>

The attr2 parameter I mentioned in my example is the LANG parameter in the
template above. Since we have a limited number of languages, it's feasible for
me to run the transform twice, once for each language. On top of that, I remove
some attributes that are specific to a language and I didn't want to mess around
with writing two output files simultaneously.

Thanks for your comments and if there are obvious improvements I could make, I'm
all ears... errr... eyes. :)

L

Reply via email to