XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] xsl processing problem with multiple templates

XSLT and XPath questions would be better posted to the following list:

   http://www.mulberrytech.com/xsl/xsl-list

There are a number of subscribers who would enthusiastically respond 
to such questions.

There is also an *excellent* XSLT FAQ at:

   http://www.dpawson.co.uk

At 2009-11-14 15:56 -0500, Ian S. Worthington wrote:
>I have a bunch of fixn.xml files which contain something like:
>
><?xml version="1.0" encoding="ISO-8859-1"?>
><?xml-stylesheet type="text/xsl" href="fix.xsl"?>
><fix>
><number>BED012</number>
>...
></fix>
>
>Apart from being able to display them alone (via the embedded xsl) I'd like to
>turn them into a list of fixes.  It looks like xinclude is what I need for
>this,

It doesn't look like that to me ... it looks like you need the 
document() function.

>My master list of fixes looks like:
>
><?xml version="1.0" encoding="ISO-8859-1"?>
><?xml-stylesheet type="text/xsl" href="xinclude.xsl"?>
><fixlist xmlns:xi="http://www.w3.org/2001/XInclude";>
>         <fix><number>BED000</number></fix>
>         <fix><number>BED111</number></fix>
>         <xi:include href="fix1.xml"/>
>         <xi:include href="fix2.xml"/>
></fixlist>

How about something like:

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="allfixes.xsl"?>
<fixlist>
         <fix><number>BED000</number></fix>
         <fix><number>BED111</number></fix>
         <fix href="fix1.xml"/>
         <fix href="fix2.xml"/>
</fixlist>

Then in allfixes.xsl have one instruction that pushes all fix elements:

   <xsl:apply-templates select="fix[not(@href)] |
                                document( fix/@href )/fix"/>

... and then handle each fix element that arrives either from the 
local file or the referred file.

>Is there anyway of getting them both to work in harmony?

The above is one push instruction for all fixes, embedded or referred.

I hope this helps.

. . . . . . . . . . Ken

--
Vote for your XML training:   http://www.CraneSoftwrights.com/x/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/x/
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:gkholman@CraneSoftwrights.com
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/x/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS