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

n2n linking. Call 4 better solution

Subject: n2n linking. Call 4 better solution
From: "Rudolf P. Weinmann" <rudolf.weinmann@xxxxxx>
Date: Thu, 3 Aug 2000 16:41:34 +0200
n2n
Hi
I have three xml files. Their elements have relationships with each other.
For example: element <c id="L1"/> of three.xml belongs to the elements with
the ids M1,M2,M3 of two.xml and so on.
In terms of a DTD the attribute LinkedTo is of type IDREFS.
I have written a stylesheet to produce the file output.xml (see below).
Are there more efficient solutions than mine (not using extensions).

Rudolf

input one.xml (primary input for my stylesheet)
<root>
    <a id="N1"/>
    <a id="N2"/>
    <a id="N3"/>
</root>

input two.xml
<root>
    <b id="M1" LinkedTo="N1 N2"/>
    <b id="M2" LinkedTo="N2 N3"/>
    <b id="M3" LinkedTo="N1"/>
</root>

input three.xml
<root>
    <c id="L1" LinkedTo="M1 M2 M3"/>
    <c id="L2" LinkedTo="M2 M3"/>
    <c id="L3" LinkedTo="M1 M3"/>
</root>

output.xml
<root>
    <a id="N1">
        <b id="M1" LinkedTo="N1 N2">
            <c id="L1" LinkedTo="M1 M2 M3"/>
            <c id="L3" LinkedTo="M1 M3"/>
        </b>
        <b id="M3" LinkedTo="N1">
            <c id="L1" LinkedTo="M1 M2 M3"/>
            <c id="L2" LinkedTo="M2 M3"/>
            <c id="L3" LinkedTo="M1 M3"/>
        </b>
    </a>
    <a id="N2" ....... you got the idea

output.xml generated using the following stylesheet

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:import href="CopyUnchanged.xsl"/>
<xsl:output method="xml"/>

<xsl:variable name="Files" select="document('two.xml') |
document('three.xml')"/>

<xsl:template match="a | b">
    <xsl:copy>
        <xsl:apply-templates select="@*"/>
        <xsl:apply-templates/>
        <xsl:apply-templates select="$Files//*[contains(concat('
',@LinkedTo,' '),concat(' ',current()/@id,' '))]"/>
    </xsl:copy>
</xsl:template>

</xsl:stylesheet>

I'm concernded about the performance. Are there better solutions?
_________________________________
Rudolf P. Weinmann
Innovation Process Technology Inc.
Switzerland



 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-2011 All Rights Reserved.