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

Re: foreign keys in a xml-database

Subject: Re: foreign keys in a xml-database
From: ChivaBaba@xxxxxxx
Date: Tue, 07 May 2002 03:55:48 EDT
.bin compiler
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


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.