[xsl] How can a template match elements created by xsl?????

Subject: [xsl] How can a template match elements created by xsl?????
From: ChivaBaba@xxxxxxx
Date: Wed, 15 May 2002 06:14:21 EDT
Hi,

I work with two xml files, the first stores projects with needed tools and the second stores the details of these tools and its releases.

projects.xml:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
..
<devEnviron name="test">
 <project name="R 30" version="A">
  <tool name="Gnu C Compiler" version="3.1.1">
   <location name="SL"/>
  </tool>
  <tool name="Gnu C++ Compiler" version="3.0.1">
   <location name="SEL"/>
  </tool>
  ... 
</project>
 ...
</devEnviron>     
++++++++++++++++++++++++++++++++++++++++++++++++++++++++

software.xml:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  ...
  <software>
   <tool name="Gnu C++ Compiler" 
     company="open source" 
         category="Compiler-Interpreter"
         phase="Coding">
     <release name="3.0.1">
       <os name="Solaris" version="5.7" kernel="1.3.0"/>
       <computer name="SEL" path="/bin/compiler">
         <docu kind="man" loc="/bin/docus">
           gcc
         </docu>
       </computer>
    ...
     </release>
     ...  
   </tool>
    ...
  </software>
++++++++++++++++++++++++++++++++++++++++++++++++++++++++

I use a key to find for each tool in projects.xml the corresponding tool/release in software.xml.
When this certain release was found, I create a tool-element and copy all attributes of the releases' parent and the release itself into this element and store it in the variable tools. Afterwards I sort this rtf and store the result in the variable sw.

dev_env.xsl:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 ...
 <xsl:variable name="sw-file" select="document('../data/software.xml')"/>

 <xsl:key name="releasekey" match="release" use="concat(../@name,'#',@name)"/>

 ...

 <xsl:template match="project" mode="sw">
  ...  
  <xsl:variable name="tools">
     <xsl:for-each select="tool">
      <xsl:variable name="key" select="concat(@name,'#',@version)"/>
      <xsl:for-each select="$sw-file">
       <xsl:variable name="release" select="key('releasekey',$key)"/>

       <tool>
        <xsl:copy-of select="$release/../@*"/>
        <xsl:copy-of select="$release"/>
       </tool>

      </xsl:for-each>
     </xsl:for-each>
    </xsl:variable>

    <xsl:variable name="sw">
     <xsl:for-each select="exsl:node-set($tools)">
      <xsl:sort data-type="text" lang="en" select="@category"/>
      <xsl:sort data-type="text" lang="en" select="@name"/>
      <xsl:copy-of select="."/>
     </xsl:for-each>
    </xsl:variable>
    ...
++++++++++++++++++++++++++++++++++++++++++++++++++++++++

The PROBLEM occurs, when I try to process this node-set by a template that matches "tool". The template is ignored and no tool is matched!!

++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    ...
    <xsl:apply-templates select="exsl:node-set($sw)"/>
  </xsl:template>


  <xsl:template match="tool">

   ...

  </xsl:template>

++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Does anybody of you experts has an idea, why this template does not process my toolnodes????

Help will be greatly appreciated!!

Best regards,

Stefan. 


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


Current Thread