Subject: Re: [xsl] stylesheet organisation From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Sat, 03 Sep 2011 09:45:25 -0400 |
I'm sorry that I dropped "as far as I know" from my posting right before I hit the Send button, but I some times take chances in order to stir up things that makes it possible for all of us to learn something.
I still feel that the spec pretty much says what I'm saying, http://www.w3.org/TR/xslt20/#import, and that most of the differences are due to the simple fact the xsl.import must be the first child.
Why is it important that it is the first child (there could be other reasons)? I am wondering if that is also how xsl:include and xsl:import are some times implemented in XSLT processors?
I'm wondering if some of the finer details, some of you mention, are actually questions of implementation?
My rule of thumb analysis has worked well for me in all trivial use cases, and if things are not trivial or if I have doubts I always test things. As a generalization, easy to remember, I have until now not been able to get anything closer than what I have already said.
t:\ftemp>type A.xsl <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/" priority="1000"> Stylesheet A </xsl:template>
</xsl:stylesheet> t:\ftemp> t:\ftemp>type B.xsl <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/" priority="1"> Stylesheet B </xsl:template>
</xsl:stylesheet> t:\ftemp> t:\ftemp>type C.xsl <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/" priority="1"> Stylesheet C </xsl:template>
</xsl:stylesheet> t:\ftemp> t:\ftemp>xslt A.xsl B.xsl con <?xml version="1.0" encoding="utf-8"?> Stylesheet A
t:\ftemp>xslt A.xsl C.xsl con <?xml version="1.0" encoding="utf-8"?> Stylesheet C
But maybe some of us can come up with some solid test cases that work across implementations to see if it is possible to make an even better rule of thumb analysis, still easy to remember as a first shot that works in most cases except in situations where we need testing anyway.
-- Contact us for world-wide XML consulting & instructor-led training Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] stylesheet organisation, Jesper Tverskov | Thread | Re: [xsl] stylesheet organisation, G. Ken Holman |
Re: [xsl] stylesheet organisation, Mark | Date | Re: [xsl] stylesheet organisation, G. Ken Holman |
Month |