XML : apply-templates not working with included file

I have a problem with xsl:include and xsl:apply-templates. I am doing some experiments with dynamic QName in xsl:call-template and I found a way

If I do this, it works good (one file - file.xsl) - it show text "test" from match template:

  <xsl:variable name="template" select="document('')/*/xsl:template"/>    <xsl:template match="xsl:template[@name='test']" name="test">      test  </xsl:template>    <xsl:template match="root">      <xsl:apply-templates select="$template[@name = $show]"/>  </xsl:template>    

($show = 'test')

But, if I put first part to different file, e.g. template.xsl and then I will call it with xsl:include, it does NOT work. I don't have idea why.

  <xsl:variable name="template" select="document('')/*/xsl:template"/>    <xsl:include href="template.xsl" />    <xsl:template match="root">      <xsl:apply-templates select="$template[@name = $show]"/>  </xsl:template>    

Is there anybody who can help me with that please? xsl:include should put content of filename.xsl to parent template but it looks like it didn't

Note: I have XSLT 1.0

No comments:

Post a Comment