Hi Con,
Below is my XSLT. It throws away some nodes based on their attributes and removes some attributes based on name. I haven't declared the xmlns in the XLST. Is it necessary to?
No, because you don't use it there, i.e. xsi is not referenced in this file (xsi:xyz).
And I really wonder about this Xalan message! A not available namespace declaration should result in an error - and it normally does so with Xalan too, I never only get a warning.
And the transformation fails? In which way?
Joerg
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Match document root. --> <xsl:template match="/" > <xsl:apply-templates /> </xsl:template>
<!-- Swallow resource-bundle-name elements --> <xsl:template match="resource-bundle-name" />
<!-- An identity-style matcher that - swallows elements which have an empty-object="true" attribute - suppresses the empty-object attribute
- suppresses the object-identifier attribute
-->
<xsl:template match="*" >
<!-- Process -->
<xsl:if test="not(@empty-object='true')" > <xsl:element name="{name()}" >
<xsl:for-each select="@*">
<xsl:if test="(not(name()='empty-object') and
not(name()='object-identifier'))" >
<xsl:attribute name="{name()}" >
<xsl:value-of select="." />
</xsl:attribute>
</xsl:if>
</xsl:for-each>
<xsl:apply-templates />
</xsl:element>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
On Thu, 2003-11-13 at 03:46, Conal Tuohy wrote:
Hi Damon
Is the xmlns declared in the XSLT too? What does the XSLT look like?
Con
-----Original Message----- From: Damon van Opdorp [mailto:[EMAIL PROTECTED] Sent: Wednesday, 12 November 2003 2:43 p.m. To: [EMAIL PROTECTED] Subject: XSLT and Namespaces Problem
Hi all,
I've having a problem getting XSLT transforms to work where there are namespaces used in my xml. Here is a snippet of the XML going into the transform:
<unit-sale-prices xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" list-item="false" empty-object="false" large-item="true" xsi:type="java:com.deeperdesign.marketplace.entity.unit.UnitSalePrice" > ...
I'm using the default Xalan based transformer and it's complaining to the log files with the following message:
javax.xml.transform.TransformerException: Could not resolve namespace prefix: xsi. The node will be ignored. at org.apache.xalan.transformer.MsgMgr.warn(MsgMgr.java:187) at org.apache.xalan.transformer.MsgMgr.warn(MsgMgr.java:144) at org.apache.xalan.templates.ElemElement.execute(ElemElement.java:344) at org.apache.xalan.templates.ElemAttribute.execute(ElemAttribute.java:144) at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2318) ...
As far as I can see, the xsi namespace is defined, but for some reason my XSLT processor isn't noticing the declaration. The xml is castor generated, it's using the xsi namespace so that it can record the type of the objects to make it possible to turn the xml back into java objects. I'm using Cocoon 2.1.1 with Tomcat 4.1.29. My Xalan version is 2.5.1.
Any suggestions welcome :)
Cheers,
Damon
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
