xsl-list
[Top] [All Lists]

Re: [xsl] Identity transform (case conversion)

2006-07-08 07:37:41
Why at all the namespace, http://www.w3.org/xml/1998/namespace is part
of node-set namespace::*. I am not sure, but does it relate to the XML
Namespaces spec? (you hinted this in your previous answers)



How do you expect otherwise to be able to use an "xml:lang" attribute
and a few more in this namespace without explicitly specifying the xml
namespace?

So, the answer to your question is that this is a convenient default.

From the XML Namespace errata:

"Namespace constraint: Reserved Prefixes and Namespace Names

The prefix xml is by definition bound to the namespace name
http://www.w3.org/XML/1998/namespace. It may, but need not, be
declared, and must not be bound to any other namespace name. No other
prefix may be bound to this namespace name."

Note also that the namespace-uri used in your code is different from
the namespace-uri for the xml namespace -- as others advised this
answers your first question.

Could you send me the code, which causes MSXML4 to produce non-"xml"
bindings to the xml namespace uri?


--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.




On 7/8/06, Mukul Gandhi <gandhi(_dot_)mukul(_at_)gmail(_dot_)com> wrote:
Thanks Mike for the clarification. I have 2 more questions..

1st question:

You earlier gave suggestion, that comparing the namespace-uri()
instead of name() will make the stylesheet (George's code) compatible
with both Saxon and MSXML. (for supressing the namespace
xmlns:xml="http://www.w3.org/xml/1998/namespace"; in output)

The relevant portion of code is (please see the code that George posted):

<xsl:for-each select="current()//namespace::*[not(.=$currentNamepsace)
and not(name()='xml')]">
    <xsl:attribute name="{translate(name(), $small,
$caps)}:dummy{position()}" namespace="{translate(., $small,
$caps)}"></xsl:attribute>
</xsl:for-each>

I changed this to:

<xsl:for-each 
select="current()//namespace::*[not(starts-with(.,'http://www.w3.org'))]">
   <xsl:attribute name="{translate(name(), $small,
$caps)}:dummy{position()}" namespace="{translate(., $small,
$caps)}"></xsl:attribute>
</xsl:for-each>

This works..

But following doesn't work (the namespace
http://www.w3.org/xml/1998/namespace is getting generated in the
output):

<xsl:for-each select="current()//namespace::*[not(. =
'http://www.w3.org/xml/1998/namespace')]">

(Please note the namespace uri comparison I am doing). What is wrong
with the string comparison here?

I am using Saxon 8.7.3.

2nd question:

Why at all the namespace, http://www.w3.org/xml/1998/namespace is part
of node-set namespace::*. I am not sure, but does it relate to the XML
Namespaces spec? (you hinted this in your previous answers)

Regards,
Mukul

On 7/8/06, Michael Kay <mike(_at_)saxonica(_dot_)com> wrote:
> > Can you please clarify whether this is a bug with Xalan-J 2.7.0:
> >
> > This instruction is not generating the namespaces in the
> > output <xsl:copy-of select="current()//namespace::*" />
> >
>
> It looks like a non-conformance to me: Erratum E25 at
> http://www.w3.org/1999/11/REC-xslt-19991116-errata/ specifies the behaviour
> of xsl:copy and xsl:copy-of when applied to namespace nodes.
>
> Michael Kay
> http://www.saxonica.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>
--~--