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

RE: Combining xml file manipulation into one xsl

Subject: RE: Combining xml file manipulation into one xsl
From: "Karen Dunstall" <kdunstall@xxxxxxxxxxxxxxx>
Date: Thu, 2 Oct 2003 10:58:30 +1000
xml file manipulation
David

This combines the two files beautifully, but it doesn't weed out the duplicates.

I made a couple of minor changes to the apply templates command (which seem reasonable, as the sort works):

<xsl:apply-templates select="doxygenindex/compound[not(key('x',name))] | document('tblMasterFile.xml')/CodeLibrary/File">
  <xsl:sort select="name|Name"/>
</xsl:apply-templates>

but I don't know enough keys to really know what I'm doing.  Any suggestions.

Thanks
Karen  

-----Original Message-----
From: David Carlisle [mailto:davidc@xxxxxxxxx]
Sent: Thursday, 2 October 2003 9:33 AM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  Combining xml file manipulation into one xsl



wel...

given your (2nd pass) input I think

        <File>
          <Name>
            <xsl:value-of select="./Name"/>
          </Name>
          <Type><xsl:value-of select="./Type"/></Type>
          <BriefDescription><xsl:value-of select="./BriefDescription"/></BriefDescription>
          <SourceFileName><xsl:value-of select="./SourceFileName"/></SourceFileName>
          <IgnoreFlag><xsl:value-of select="./IgnoreFlag"/></IgnoreFlag>
        </File>

can be replaced by
<xsl:copy-of select="."/>

which means that basically you should be able to merge this in to your
first stylesheet. (In general in pure xslt 1 to merge the results of two
stylesheets you need to do what you are doing, produce an intermediate
documemt, but as one of your transforms is just a copy I think you want
something like


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" omit-xml-declaration="yes"/>

<xsl:key name="x" match="File" use="Name"/>

  <xsl:template match="/">
     <CodeLibrary>
    <xsl:apply-templates
select="doxygenindex/compound[not(key('x',@name)]|document('tblMasterFile.xml')/CodeLibrary/File">
       <xsl:sort select="@name|Name"/>
    </xsl:apply-templates>
    </CodeLibrary>
  </xsl:template>

  <xsl:template match="doxygenindex/compound">
    <File>
    <Name><xsl:value-of select="name"/></Name>
    <Type><xsl:value-of select="@kind"/></Type>
    <BriefDescription/>
    <SourceFileName><xsl:value-of select="@refid"/></SourceFileName>
    <IgnoreFlag>77</IgnoreFlag>  
    </File>
  </xsl:template>

<xsl:template match="File">
  <xsl:copy-of select="."/>
</xsl:template>


</xsl:stylesheet>


David

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


 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.