jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james_strac...@yahoo.co.uk>
Subject Re: XML aggregation
Date Tue, 17 Jul 2001 15:45:44 GMT
Hi John

From: "Morrison, John" <John.Morrison@uk.experian.com>
> I'm trying to aggregate two pieces of xml prior to applying a xsl
> transformation to the results but all the combinations I've tried have
come
> to naught.  Could somebody please tell me if
> 1) its possible ;)

Yes :-)


> and 2) how
> to do it!.

There's a few different ways.

In XSLT you can use the document() function to load other documents.

http://www.zvon.org/xxl/XSLTreference/Output/function_document.html


Or, if the 2 documents are static and do not have the <?xml version="1.0"?>
declarations then you could do this

<xsl:apply xsl="/WEB-INF/stylesheets/sample.xsl">
<aggregated>
<io:request url="one.xml"/>
<io:request url="two.xml"/>
</aggregated>
</xsl:apply>

If you have the documents locally as files you could just do this

<xsl:apply xsl="/WEB-INF/stylesheets/sample.xsl">
<aggregated>
<%@include file="one.xml" %>
<%@include file="two.xml" %>
</aggregated>
</xsl:apply>


Hopefully in a few days time you'll be able to do things like the following
in XTags (when some new code developed by James Elson is incorporated):-

<!-- create the composite document -->
<xtags:parse>
<aggregated/>
</xtags:parse>

<!-- append child documents to root element -->
<xtags:forEach select="/aggregated">
    <xtags:add>
        <io:request url="one.xml"/>
    </xtags:add>

    <xtags:add>
        <io:request url="two.xml"/>
    </xtags:add>
</xtags:forEach>

<!-- now style the composite document -->
<xtags:style xsl="/WEB-INF/stylesheets/sample.xsl"/>


James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Mime
View raw message