hey guys, i'm trying to track down a weird namespace related problem in
c2. i've got an aggregated xml result set that looks something like this:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<w:page
xmlns:xsp-cookie="http://apache.org/xsp/cookie"
xmlns:xsp="http://apache.org/xsp"
xmlns:w="http://intranet.webslingerZ.com/xml/site/v1"
xmlns:xspdoc="http://apache.org/cocoon/XSPDoc/v1"
xmlns:esql="http://apache.org/cocoon/SQL/v2"
xmlns:wzi="http://intranet.webslingerZ.com/xml/xsp/v1"
xmlns:xsp-request="http://apache.org/xsp/request"
>
<w:title>Client</w:title>
<w:body>
<clients>
<client>...</client>
...
</clients>
</w:body>
</root>
so underneath the w:body element, there's a clients element with no
namespace. no default namespace is declared. all right so far? so now i
want to apply a stylesheet to transform the clients tree fragment into
elements in the w namespace. so i've got a stylesheet which does just
that:
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:w="http://intranet.webslingerZ.com/xml/site/v1"
version="1.0"
>
<xsl:template match="clients">
<w:table type="data">
<w:title>Clients</w:title>
<xsl:for-each select="client">
<w:row>
<w:cell>
<a href="client?id={id}">
<xsl:value-of select="name"/>
</a>
</w:cell>
</w:row>
</xsl:for-each>
</w:table>
</xsl:template>
<xsl:template match="node()" priority="-2">
<xsl:copy>
<xsl:apply-templates select="node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
now if i apply the stylesheet by hand using xalan1 or xt, i get what i
expect - a copy of the source xml with the clients fragment transformed
into a w:table fragment. but if i apply the stylesheet in the sitemap:
<map:transform src="style/clients.xsl"/>
i get this:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<w:page
xmlns:xsp-cookie="http://apache.org/xsp/cookie"
xmlns:xsp="http://apache.org/xsp"
xmlns:w="http://intranet.webslingerZ.com/xml/site/v1"
xmlns:xspdoc="http://apache.org/cocoon/XSPDoc/v1"
xmlns:esql="http://apache.org/cocoon/SQL/v2"
xmlns:wzi="http://intranet.webslingerZ.com/xml/xsp/v1"
xmlns:xsp-request="http://apache.org/xsp/request"
>
<w:title>Client</w:title>
<w:body>
<clients xmlns="http://intranet.webslingerZ.com/xml/site/v1">
<client>...</client>
...
</clients>
</w:body>
</root>
for the _life_ of me, i cannot figure out what's going wrong. it's as if
the stylesheet transformer is seeing the incoming xml document as having a
default namespace of "http://intranet.webslingerZ.com/xml/site/v1". if i
modify the stylesheet to operate on the clients elements if they belong to
that namespace:
<xsl:template match="w:clients">
<w:table type="data">
<w:title>Clients</w:title>
<xsl:for-each select="w:client">
<w:row>
<w:cell>
<a href="client?id={w:id}">
<xsl:value-of select="w:name"/>
</a>
</w:cell>
</w:row>
</xsl:for-each>
</w:table>
</xsl:template>
i get the results i expect, but it should not be the case that the input
clients element belongs to any namespace, much less the w: one. any ideas,
folks?
- donald
---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org
|