xsl-list
[Top] [All Lists]

RE: [xsl] Upgrading to XSLT 2.0

2006-10-24 11:58:58
 
Greetings,

...my brief search in the archives came up empty on this, and my question has 
been re-triggered with the recent thread involving an error with Java 1.5, so 
here goes...

In my brief recent foray into XSL, I'm already noticing the benefits of moving 
to XSLT 2.0
(One that comes immed. To mind is the built-in functions for date/time 
formatting);

My work environment employs an XSLT1.0 processor (some version of both Xalan 
and Saxon running somewhere I've been told), and while I don't work directly 
with configuring the processors, (and sadly don't have the version details)
From a (largely front-end template) developer's POV, I would like to recommend 
an updgrade to XSLT 2.0.

My question: How easy/painful is this processor/language upgrade?
Based on my readings, seems like XSL processors are mostly backward compatible 
to deal with version="1.0" code, but what is the list experience with this 
transition? Do versions of Java and other server-based software have an impact 
on making this upgrade?

Please forgive if this question seems a bit naïve

Cheers,
bill

Bill Lorand
Web Developer
E*TRADE Financial
william(_dot_)lorand(_at_)etrade(_dot_)com


-----Original Message-----
From: Michael Kay [mailto:mike(_at_)saxonica(_dot_)com] 
Sent: Tuesday, October 24, 2006 11:44 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] Error when switching to java 1.5


You either need to pursue the problem with the support channel for the XSLT 
processor in question, or you need to switch to a different XSLT processor.
Trying to change your code to work around the problem isn't a good way forward 
unless you know very specifically what the problem is.

Michael Kay
http://www.saxonica.com/

-----Original Message-----
From: footh [mailto:footh(_at_)yahoo(_dot_)com]
Sent: 24 October 2006 19:38
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: Re: [xsl] Error when switching to java 1.5

Thanks for the reply.

I am using Xalan 2.7 which implements XSLT 1.0.

The idea behind the identity template is to just repeat the source 
XML.  So, that is my desired result.
 In this case, I have HTML mixed in with custom XML. 
The custom XML gets transformed with specific templates while the HTML 
should just be copied over.

I've experimented a little on the results.  It turns out that the 
error occurs when the processor first hits an attribute inside an HTML 
tag.  What I did was change the problematic "apply-templates" tag to 
this:

<xsl:apply-templates select="@id|node()" />

Then used a simple source XML doc:

<div id="someid">hello</div>

And, I received the error.  But if I took out the "id"
attribute then I did not receive the error.  Of course, if I changed 
it to another attribute, then I wouldn't receive an error, but the 
attribute would not be copied to the result.

So, clearly, something is going wrong with coping over attributes.

Note that if I use this identity template:

<xsl:template match="@*|node()">
  <xsl:copy>
    <xsl:apply-templates select="@*|node()"/>
  </xsl:copy>
</xsl:template>

Everything works fine.  BUT, this template does not remove namespaces 
(which causes the result to not conform to valid XHTML).

So, if anyone can suggest another way to have an identity template 
that removes namespaces, that would be great.  For reference, here is 
the identity template combo I'm using that is problematic (on the 
second template):

<xsl:template match="@*">
  <xsl:attribute name="{name()}"
namespace="{namespace-uri()}">
   <xsl:value-of select="." />
  </xsl:attribute>
</xsl:template>

<xsl:template match="*">
  <xsl:element name="{name()}"
namespace="{namespace-uri()}">
   <xsl:apply-templates select="@*|node()" />
  </xsl:element>
</xsl:template>




--- Mukul Gandhi <gandhi(_dot_)mukul(_at_)gmail(_dot_)com> wrote:

Can you please tell, what is your source XML and the desired output?

Which XSLT processor and its version are you using?
Are you using XSLT
1.0 or XSLT 2.0?

This information will help us to solve the problem.

On 10/21/06, footh <footh(_at_)yahoo(_dot_)com> wrote:
I am using an identity template that removes namespaces
in a Cocoon
application that runs under Tomcat.  Previously, I was using Java
1.4.2 but
once I
switched to Java 1.5 I receive a null pointer
TransformerException.  
Following is the identity template that matches all nodes.  The 
error occurs
on
the "apply-templates" tag.  On the "select"
attribute,
the presence of the "@*" symbol causes the error. 
If
I remove it, everything is fine.  However, then
attributes of nodes
are not rendered.  Has anyone encountered this problem
before?  Any
suggestions?

 <xsl:template match="*">
  <xsl:element name="{name()}"
namespace="{namespace-uri()}">
    <xsl:apply-templates select="@*|node()" />
  </xsl:element>
 </xsl:template>


--
Regards,
Mukul Gandhi


--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>