At 2008-12-12 14:40 -0800, Fred Christian wrote:
Thanks for the help. You wrote: "It is available to you if you
declare xpath-default-namespace= in multiple places in your
stylesheet, but that gets awkward."
I think that is what I should be doing to have less impact on
existing code. And at least in my simplified test files I have figured it out.
Yes, it looks like you have.
I have another question now. Here is what I did so far in my test files:
<xsl:template match="EOUProblems">
<xsl:variable name="psetDoc">psettest7.xhtml</xsl:variable>
<xsl:for-each select="document(string($psetDoc))"
xpath-default-namespace="http://www.w3.org/1999/xhtml">
<xsl:for-each select="//div">
4)<xsl:value-of select="name(.)"/>#
<xsl:copy-of select="."/>
<xsl:apply-templates />
</xsl:for-each>
</xsl:for-each>
</xsl:template>
<xsl:templates match="div"
xpath-default-namespace="http://www.w3.org/1999/xhtml">
some transform
</xsl:template>
I figured out that I need xpath-default-namespace anywhere I want to use it.
Is there some way that I can use one template for both this default
namespace and the null namespace? I have lots of code that operates
on the base xml file, that I would like to re-use on the sub file.
Split your stylesheet into two fragments and use either <xsl:include>
or <xsl:import> (probably include since you want everything at the
same level of importance) from one to access the other.
In one stylesheet put all of the templates that match elements in
your XML namespace, and use one xpath-default-namespace= declaration
at the top.
In the other stylesheet put all of the templates that match elements
in the XHTML namespace, and use one xpath-default-namespace=
declaration at the top.
Those declarations would then only have scope within their respective
files and you won't need to clutter your stylesheet fragments with
multiple declarations.
I hope this helps.
. . . . . . . . . . . Ken
--
Upcoming XSLT/XSL-FO, UBL and code list hands-on training classes:
: Sydney, AU 2009-01/02; Brussels, BE 2009-03; Prague, CZ 2009-03
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video sample lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg
Video course overview: http://www.youtube.com/watch?v=VTiodiij6gE
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
--~------------------------------------------------------------------
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>
--~--