Re: [xsl] xsl, and different xml versions

Subject: Re: [xsl] xsl, and different xml versions
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 15 Apr 2005 11:21:55 +0100
As others have commented you can not use xsl:import that way, also


>  <xsl:template match="/">
>    <xsl:if test="@version = '1'">   

match="/" matches the document root (ie the logical top of th edocument)
not the top level document element, root nodes never have attributes so
your test would always be false you need to test /*/@version.

An alternative (or addition0 to using version would be to use teh
stylesheet PI which is exactly for this use

Given the files

<?xml-stylesheet type="text/xsl" href="version1.xsl"/>
<report>
  <table foo="bar"/>
  <text value="sometext"/>
</report>

<?xml-stylesheet type="text/xsl" href="version2.xsl"/>
<report>
  <table foo="bar"/>
  <text value="sometext"/>
</report>

Any processor which supports xml-stylesheet will do what yuou want. This
includes, at least, Internet explorer, Mozilla and saxon (if given the -a flag)

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread