|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: combining 2 different XML files within the same XS
Todd,
There are any number of approaches to do what you're describing: I'll just describe a simple quick-and-dirty "forced merge". You name the two files in a separate config or "driver" file: <files> <file>file1.xml</file> <file>file2.xml</file> </files> This will be the source file for your transformation, in which you do something like: <xsl:variable name="mergedset" select="document(/files/file)"/> <xsl:template match="/">
<!-- matching on the root node of your config file -->
<apps>
<xsl:apply-templates select="$mergedset" mode="process"/>
<!-- this mode just bumps you off the default so you can match the roots
of your merging documents separately -->
<!-- you need to wrap them in your <apps> here since there'll be more than
one root and you don't want more than one <apps> -->
</apps>
</xsl:template><xsl:template match="/" mode="process">
<!-- this template will now match your merging documents' roots -->
<xsl:apply-templates select="//date">
<!-- since your criterion is your date, we'll go straight to them -->
<xsl:sort type="number"/>
<!-- let's sort em while we're at it -->
</xsl:apply-templates>
</xsl:template><xsl:template match="date">
<xsl:if test="
...do your test against your criterion of what to include;
it could of course be parameterized
">
...
this is where the action will happen: you'll probably go up a step
(for-each select=".."), but there's lots of ways to skin this cat:
the point is you'll build your <app> here and fill it with whatever
you've got
...
</xsl:if>
</xsl:template>I am trying to create a NEW list of XML nodes from either file that meet a certain criteria. BTW (small point), as an English teacher I can't help but urge you to understand that "criteria" is a plural noun in our fine language (the word comes from Greek), and what you mean to say is "nodes from either file that meet a certain criterion"... :-> Note also that what I'm outlining is a *separate pass* (a pre-process) to create a list of <app> elements, not itself suitable for display. Handle that either in a second pass, or combine the logic (this is not prima facie impossible) to create your output format with this merging logic, skipping the apps/app stage altogether. I hope that helps! Cheers, Wendell At 12:32 PM 8/27/2002, you wrote: I have 2 different XML files that have different node structure, but similar information (both contain date related information) ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








