xsl-list
[Top] [All Lists]

[xsl] Namespaces.

2006-03-30 03:30:56

Hi
I want have the following:

<files>
 <supplier>
   ...
 </supplier>
 <customRows>
  ..
 </customRows>
</files>

Now, I want to copy customRows into supplier. I created the following code to do this:

<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
   xmlns:sup="http://www.calypso.net.au/apps/supub/SupplierV1.0";>
 <xsl:template match="files">
    <xsl:apply-templates select="sup:supplier"/>
</xsl:template>
 <xsl:template match="sup:supplier">
   <supplier>
     <xsl:apply-templates select="@*|node()"/>
     <supplementary>
     <xsl:apply-templates select="../customRows"/>
     </supplementary>
   </supplier>
 </xsl:template>

 <xsl:template match="@*|node()">
   <xsl:copy>
     <xsl:apply-templates select="@*|node()"/>
   </xsl:copy>
 </xsl:template>
</xsl:stylesheet>

Works fine, except it copies namespace information to children nodes that doesn't seem to exists. eg:

<supplier xmlns:sup="http://www.calypso.net.au/apps/supub/SupplierV1.0";>
<priority xmlns="http://www.calypso.net.au/apps/supub/SupplierV1.0"; xmlns:dir="http://apache.org/cocoon/directory/2.0"; xmlns:cinclude="http://apache.org/cocoon/include/1.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>1</priority> <name xmlns="http://www.calypso.net.au/apps/supub/SupplierV1.0"; xmlns:dir="http://apache.org/cocoon/directory/2.0"; xmlns:cinclude="http://apache.org/cocoon/include/1.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>BERJAYA EDEN PARK</name> <thumbNail xmlns="http://www.calypso.net.au/apps/supub/SupplierV1.0"; xmlns:dir="http://apache.org/cocoon/directory/2.0"; xmlns:cinclude="http://apache.org/cocoon/include/1.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>thumb.jpg</thumbNail>
...

I have checked, these elements are not in the source document, and it only seems to affect the children of supplier. How can I keep the xmlns:xsi information for supplier, but not copy it into the children.

Thanks.

Any ideas?

Cheers.

Kamal.

--
Kamal Bhatt

Tourism Technology Pty Ltd


T:  +61 (02) 9956 7300
F:  +61 (02) 9956 7411


Level 10, 1 Pacific Highway, North Sydney, NSW 2060


http://www.tt.com.au


--
Disclaimer: This email is confidential and may contain privileged information 
for the sole use of the person or business to which it is addressed. If you are 
not the intended recipient, please notify the sender by return e-mail or phone 
as you must not view, disseminate, distribute or copy this email without our 
consent. We do not accept any liability in connection with any computer virus, 
data corruption, incompleteness, or unauthorised amendment of this email. It is 
the sole responsibility of the receiver to scan for viruses before opening.

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>