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

xsl processing problem with multiple templates

  • From: "Ian S. Worthington" <ianworthington@usa.net>
  • To: <xml-dev@lists.xml.org>
  • Date: Sat, 14 Nov 2009 15:56:05 -0500

xsl processing problem with multiple templates
Hi.

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, but it isn't actually implemented in any standard browser yet.  However
there's a partial workaround at http://forums.devx.com/showthread.php?t=160331
which I'm trying to get going. 

But I appear to be able to drive the including *or* the transformation, but
not both.  Is this just a namespace issue or is there something insurmountable
here?

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>

and the xinclude.xsl, based off the referenced article:

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:f="f" 
xmlns:xi="http://www.w3.org/2001/XInclude" exclude-result-prefixes="xi">

	<xsl:include href="no-ns-identity.xsl"/>
	
	<xsl:template match="xi:include">
	  <xsl:message>Matched include root</xsl:message>
		<xsl:apply-templates select="document(@href)"/>
	</xsl:template>		
 
  <xsl:template match="fixlist">
    <xsl:message>Matched data root</xsl:message>
    <html>
    <body>
      <xsl:for-each select="fix">
        <p>Change number: <xsl:value-of select="number"/></p>
      </xsl:for-each>
    </body>
    </html>
  </xsl:template> 
 </xsl:stylesheet>


Like this, the fixlist match fires and generates the desired html, but without
the includes.

Or if I prevent the fixlist from matching then the xi:include match will fire
and the correct xml is generated, but (of course) is not transformed into
html.

I've tried putting the fixlist into a different namespace, but with no
difference.

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

ian 
.. 

Ian S. Worthington, MBCS.

me:     http://isw.me.uk/ 
photos: http://gallery.isw.me.uk/ 


Free 2GB online backups:
  https://mozy.com/?code=HJW4C8 (code gets you 256MB extra)

Web hosting and support from $2.99/month:
  www.cirtexhosting.com/affiliates/idevaffiliate.php?id=463


Dulce et decorum est pro patria mori, sed dulcius pro patria vivere, et
dulcissimus pro patria biber. Ergo, bibiamo pro salute patriae.







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