cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conny Krappatsch <>
Subject RE: XSLT and namespaces: two different planets
Date Fri, 25 Aug 2000 07:26:17 GMT
I would agree with Ed,

I'm missing a very important part in Stefano's stylesheet example: the
namespace(ns) declaration. The stylesheet should look like this:

<xsl:stylesheet ...

    <xsl:template match="my:page">

'my:page' will be expanded using the ns declaration (see Ed's mail).
The prefix can be seen as a link between the elements and the ns
declaration. You can even have several elements (and attributes) with different
prefixes belonging to the same ns (if you set your ns declarations


Ed Staub wrote:
> Stefano,
> I don't understand...
> clearly you didn't really move the page, just changed the namespace prefix
> in this context.
> Is the issue that the prefix in the stylesheet has to change if a matching
> _source_ prefix changes?  I don't believe this is true; namespaces are
> matched on the URI, not the prefix.  I haven't checked this to be positive
> that it's implemented correctly in Xalan, but I bet it is.  The XPath spec
> is pretty clear; in section 2.3: "A node test that is a QName is true if and
> only if the type of the node (see [5 Data Model]) is the principal node type
> and has an expanded-name equal to the expanded-name specified by the QName."
> ("Expanded name" is local part + URI.
> Is the issue that the prefix in the stylesheet has to change if a matching
> destination prefix changes?  This can be dodged with <xsl:namespace-alias>,
> assuming it works correctly.
> Or, in door #3... did I miss your point entirely?
> -Ed Staub
> -----Original Message-----
> From: Stefano Mazzocchi []
> Sent: Thursday, August 24, 2000 2:32 PM
> To: Cocoon; Scott Boag
> Subject: XSLT and namespaces: two different planets
> I got my hands dirty with SAX2 and, man, I love their namespace support,
> it's great, clean, perfect, just fits perfectly with what I need.
> Then I look at XSLT and, hmmm, their level of namespace support isn't
> quite what I like... ok, let's make an example:
>  <my:page xmlns:my="">
>    ...
>  </my:page>
> How would a "normal" person access this in XSLT? simple
>  <xsl:template match="my:page">
>  </xsl:template>
> All right (I know you already smell the problem, but keep going) then I
> move my page to
>  <my-stuff:page xmlns:my-stuff="">
>   ...
>  <my-stuff:page>
> because I found that that the "my" prefix is used in another (and more
> famous) schema.
> Great, while good behaving SAX2 applications don't give a damn since the
> "page" element is correctly interpreted (in memory) as
> no matter what prefix is used (as the namespace spec rules), in XSLT...
> well, I honestly don't know.
> Please help, the XPath spec is not very clear about this.
> --
> Stefano Mazzocchi      One must still have chaos in oneself to be
>                           able to give birth to a dancing star.
> <>                             Friedrich Nietzsche
> --------------------------------------------------------------------
>  Missed us in Orlando? Make it up with ApacheCON Europe in London!
> ------------------------- http://ApacheCon.Com ---------------------
Conny Krappatsch

View raw message