Hi Dave,

I've used some simple workarounds to "make a copy" of a node. So, while
not cloning the node per say, in my case a copy was "good enough".
Perhaps it might be for you?

Mind, this uses an exslt function (which xalan-j supports of course).

e.g.:
<xsl:stylesheet 
        version="1.0" 
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
        xmlns:exsl="http://exslt.org/common"; 
        extension-element-prefixes="exsl">

...

                <xsl:variable name="cat_temp">
                        <xsl:for-each select="$category_blog">
                                <xsl:element name="category">
                                        <xsl:attribute name="name"><xsl:value-of
select="@name"/></xsl:attribute>
                                        <xsl:attribute name="type"><xsl:value-of
select="@type"/></xsl:attribute>
                                        <xsl:attribute 
name="mode">blog</xsl:attribute>
                                </xsl:element>
                        </xsl:for-each>
                        <xsl:for-each select="$category_podcast">
                                <xsl:element name="category">
                                        <xsl:attribute name="name"><xsl:value-of
select="@name"/></xsl:attribute>
                                        <xsl:attribute name="type"><xsl:value-of
select="@type"/></xsl:attribute>
                                        <xsl:attribute 
name="mode">podcast</xsl:attribute>
                                </xsl:element>
                        </xsl:for-each>
                </xsl:variable>
                
                <xsl:variable name="category_defs"
select="exsl:node-set($cat_temp)/category"/>

...

What this does is aggregate two node sets into a single one
(category_defs) so they could be sorted, etc...

Hope that helps,

Raymond Augé
Software Engineer
Liferay, Inc.
Enterprise. Open Source. For Life.


On Wed, 2008-02-06 at 01:30 -0500, Dave Brosius wrote:

> Hi folks,
> 
>     I'm trying use cloneNode from a node retrieved from a extension function 
> parameter, or alternatively creating a node from node.getOwnerDocument on 
> the node that is the extension function parameter. I seem to be getting 
> errors of the form
> 
> SystemId Unknown; Line #8; Column #41; org.apache.xml.dtm.DTMDOMException:
> 
> Is this something that just can't be done, or am i doing something wrong?
> 
> Or instead should I just create my own document in the extension function 
> and add nodes to it, finally returning NodeLists from this document back to 
> the xsl file?
> 
> 
> Thanks. 
> 
> 

Reply via email to