This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: foreign keys in a xml-database


Hi folks,

> Assuming that you mean files with XML content, yes,
> you can store stuff in a second file and refer to
> parts of it during an XSL transformation. There is
> no formal declaration of a foreign key in the sense
> this term is used for RDBMS.

first I want to thank J. Pietschmann for steering me in the right direction!

But my attempts to implement it, created a bunch of new problems. 

I have two xml-files, the first stores projects and references to needed tools, the second stores the details of this software:

first.xml:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
<devEnviron name="Oscar">
  <project name="RR 30" version="A">
    <tool name="Gnu C Compiler" version="3.0.1">
      <location name="SDBH58"/>
    </tool>
    <tool name="Gnu Debugger" version="2.4.1">
      <location name="SDBWAW"/>
    </tool> 
     ....
  </project>
...
</devEnviron>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++

second.xml:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
 <software>
   <tool name="Gnu C Compiler"
     company="open source" 
         category="Compiler-Interpreter"
         phase="Coding">

     <release name="3.0.1">
       <os name="Solaris" version="7" kernel="1.3.0"/>
       <computer name="SDBWAW" path="/bin/compiler">
         <docu kind="man" loc="/bin/docus">
           gcc
         </docu>
       </computer>
       <docu kind="url" loc="internet">
         www.gcc.com
       </docu>
     </release>
 
     <release name="3.1.1">
       <os name="Solaris" version="7" kernel="1.3.1"/>
       <computer name="SDBH58" path="/bin/compiler">
         <docu kind="man" loc="/bin/tools/docus">
           gcc
         </docu>
       </computer>
       <docu kind="url" loc="internet">
         www.gcc.com
       </docu>
     </release>
     .... 
  </tool>
 
   <tool name="Gnu Debugger"
     company="open source" 
         category="Debugger" 
         phase="Coding">
   
     <release name="2.4.1">
       <os name="Solaris" version="7" kernel="1.3.0"/>
       <computer name="SDBWAW" path="/bin/debugger">
         <docu kind="man" loc="/bin/docus">
           gdb
         </docu>
       </computer>
       <docu kind="url" loc="internet">
         www.gdb.com
       </docu>
     </release>      
     ..... 
  </tool>
    ....
 </software>
++++++++++++++++++++++++++++++++++++++++++++++++++++++

The Stylesheet I use, transforms the first.xml into html-files. The problem I got in my xsl-file now,is that I need to output for each project the included tools sorted first by category and second by name. That means I have to copy the tool-nodes from second.xml whose name fits any tool-node-name in the current project of first.xml. 
The first difficuilty is, that I want only those release-nodes (childs of tools from second.xml) to be copied, whose name fits the version-attribute of the current tool-node in first.xml.
The second difficuilty is, to sort the copied tool-nodes by their category-attribute and their name. After this has been done I want to output all data of each tool and its children ( releases ).

Within my project-template I copy the tool-nodes to a variable, which I use later to expand the tool-nodes:

++++++++++++++++++++++++++++++++++++++++++++++++++++++
<xsl:variable name="sw">
  <xsl:for-each select="tool">
     <xsl:copy-of select="document('second.xml')
               /software/tool[@name = current()/@name]"/>
 
<!-- <xsl:sort data-type="text" lang="en" select="@category"/>
      <xsl:copy-of select="."/> -->
 
     </xsl:for-each>
    </xsl:variable>
........
........
   <xsl:apply-templates select="exsl:node-set($sw)"/>

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

As you see, I only copy all tool-nodes whose names fit the names of tool-nodes within my project at the moment. The sort I had to deactivate, cause it did not work.

Does anybody know how to solve these difficuilties??? I would be very glad to get some suggestions!!

Many thanks in advance,

Stefan Greim

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]