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, how to copy a node andonly one/some of its childs


ChivaBaba@aol.com wrote:
> The PROBLEM is, that the above construction copies each tool
 > with all its childs ( releases ) from second.xml and not only
 > those, whose @name fits @version of the corresponding tool from first xml.

Match the release and copy stuff from the parent (the tool) as
needed:
  <xsl:key name="tool-release" match="release"
    use="concat(../@name,'#',@name)"/>
...

    <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('tool-release',$key)"/>
         <tool>
           <xsl:copy-of select="$release/../@*"/>
           <xsl:copy-of select="$release/../*[not(self:release)]"/>
           <xsl:copy-of select="$release"/>
         </tool>
       </xsl:for-each>
      </xsl:for-each>
     </xsl:variable>

J.Pietschmann


 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]