Now I have a line in the xslt file:

<xsl:include href="/xslt/file.xslt" /> 

Is it possible to ensure that if a file has a parameter, then the file file.xslt is connected, and if there is no parameter, then file2.xslt?
I tried it, but it does not work ...

 <xsl:choose> <xsl:when test="$variable"> <xsl:include href="/xslt/file.xslt" /> </xsl:when> <xsl:otherwise> <xsl:include href="/xslt/file2.xslt" /> </xsl:otherwise> </xsl:choose> 

    3 answers 3

    Use the <xsl:if> construct.

      Try variable $variable compare with some value. For example, get an empty variable and compare $variable with it, or just $variable = '' .

      • did not help :( - gooda
      • @gooda, how is $variable defined? - orkaan

      Not. Only xsl:stylesheet can be the parent element for xsl:include