[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

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

Subject: How can a template match elements created by xsl?????
From: ChivaBaba@xxxxxxx
Date: Wed, 15 May 2002 06:14:21 EDT
xsl match element
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.