| | |
copy root node - urgent
Please support our XML, XSLT and XPATH advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Feb 2009
Posts: 9
Reputation:
Solved Threads: 0
I really need help in copying the root node.
I have been spending far too much time on this, and I can't beleive that it should be that difficult. I can't use 'copy-of', as that will copy all the children as well. I need to copy the root node, and it's attributes. This is what I currently have:
The above xsl will thow an error. It has something to do with namespaces. The error is:
An attribute whose value must be a QName had the value ''
I have tried using the namespace attribute, plus a heap of other things. All I wish to do is to copy the root node. Can somebody please help me with this. Thankyou.
I have been spending far too much time on this, and I can't beleive that it should be that difficult. I can't use 'copy-of', as that will copy all the children as well. I need to copy the root node, and it's attributes. This is what I currently have:
XML, XSLT and XPATH Syntax (Toggle Plain Text)
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pre="http://schemas.namespace.org/myschema/myschame.xsd"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <xsl:element name="{name()}"> <xsl:apply-templates select="pre:Msg" /> </xsl:element> </xsl:template> <xsl:template match="pre:Msg"> <xsl:for-each select="pre:Record"> <xsl:sort select="pre:ReplaceRecord/pre:Id/pre:Number" /> <xsl:sort select="pre:EventSequenceNumber" data-type="number"/> <xsl:copy-of select="." /> </xsl:for-each> </xsl:template> </xsl:stylesheet>
The above xsl will thow an error. It has something to do with namespaces. The error is:
An attribute whose value must be a QName had the value ''
I have tried using the namespace attribute, plus a heap of other things. All I wish to do is to copy the root node. Can somebody please help me with this. Thankyou.
•
•
Join Date: Feb 2009
Posts: 9
Reputation:
Solved Threads: 0
I beleive I have it now. I needed the following:
A case of still learning XSL.
XML, XSLT and XPATH Syntax (Toggle Plain Text)
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pre="http://schemas.namespace.org/myschema/myschame.xsd"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <xsl:apply-templates select="pre:Msg" /> </xsl:template> <xsl:template match="pre:Msg"> <xsl:copy> <xsl:for-each select="pre:Record"> <xsl:sort select="pre:ReplaceRecord/pre:Id/pre:Number" /> <xsl:sort select="pre:EventSequenceNumber" data-type="number"/> <xsl:copy-of select="."/> </xsl:for-each> </xsl:copy> </xsl:template> </xsl:stylesheet>
A case of still learning XSL.
![]() |
Other Threads in the XML, XSLT and XPATH Forum
- Previous Thread: Creating List in XSLT
- Next Thread: Sorting XML
Views: 988 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for XML, XSLT and XPATH
api blogger blogging code dataset delete development dynamiccreationofnvariablesinxslt error firstthreecharacterofastringrequired flipbook gdata google html include java link linspire linux microsoft news node openoffice overwrite precedence programming rss serialization standards swf template transform variable w3c web xml xmlnotloading xmlonserver xsl xslt





