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

Re: xsl processing problem with multiple templates

  • From: "Ian S. Worthington" <ianworthington@usa.net>
  • To: "G. Ken Holman" <gkholman@CraneSoftwrights.com>,<xml-dev@l...>
  • Date: Sat, 14 Nov 2009 16:55:39 -0500

Re:  xsl processing problem with multiple templates
Hi Ken --

The idea of pushing is new to me I'm afraid.  Where should that
"apply-templates" line go?
Obviously not here:

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:template match="fixlist">
    <xsl:message>Matched data root</xsl:message>
    <html>
    <body>
      <xsl:for-each select="fix">
        <xsl:apply-templates select="fix[not(@href)] |
document( fix/@href )/fix"/>
        <p>Change number: <xsl:value-of select="number"/></p>
      </xsl:for-each>
    </body>
    </html>
  </xsl:template> 
</xsl:stylesheet>

where the inlines get processed fine but not the referrals.

i
------ Original Message ------
Received: 04:22 PM COT, 11/14/2009
From: "G. Ken Holman" <gkholman@CraneSoftwrights.com>
To: <xml-dev@lists.xml.org>
Subject: Re:  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
> 
> 
> _______________________________________________________________________
> 
> XML-DEV is a publicly archived, unmoderated list hosted by OASIS
> to support XML implementation and development. To minimize
> spam in the archives, you must subscribe before posting.
> 
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
> subscribe: xml-dev-subscribe@lists.xml.org
> List archive: http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
> 
> 





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


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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.