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

Re: trying to figure out handling namespace issues

Subject: Re: trying to figure out handling namespace issues
From: Fred Christian <fredc@xxxxxxxxxx>
Date: Fri, 12 Dec 2008 14:40:47 -0800
Re:  trying to figure out handling namespace issues
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.
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.


Thanks

G. Ken Holman wrote:
If solution (2) were available to you it would look like the following:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xpath-default-namespace="http://www.w3.org/1999/xhtml">
...
                  <xsl:for-each select="div">
                    4)<xsl:value-of select="name(.)"/>#

.... but it would interfere with your match= of the no-namespace elements in your XML file, so this approach is not easily available to you. It is available to you if you declare xpath-default-namespace= in multiple places in your stylesheet, but that gets awkward.

Current Thread

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