Subject: RE: [xsl] xmlns attr for element nodes creating problem with xslt From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Mon, 23 Apr 2007 13:08:17 +0100 |
It's rather unorthodox to treat the presence of a namespace declaration as significant if there are no elements or attributes in your document actually using that namespace: this isn't the way namespaces were intended to be used. However, it can be done: <xsl:copy-of select="//INDEX[namespace::doc='http://xmlns.oracle.com/ku']"/> What you can't do is to treat namespace declarations as attributes. In the XPath data model, namespaces and attributes are quite different things, that just happen to share a similar surface syntax. Also: who allocated the namespace "http://xmlns.oracle.com/ku" and what does it mean? Namespaces in "oracle.com" should (as a matter of etiquette and good design practice) be allocated only by Oracle Corp as the owner of the domain name. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Dhanu Ubale [mailto:dhanu.u@xxxxxxxxx] > Sent: 23 April 2007 12:40 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: [xsl] xmlns attr for element nodes creating problem with xslt > > Hi all, > I m facing a small issue. I have a xml file for which i have > written a xsl file to transform to another xml(demo.xml).I am > not able to select the nodes which have xmlns attribute. Can > u tell me what has to be done.Snapshot of files: > xml file: > <ROWSET> > <ROW> > <INDEX version="1.0" > > <SCHEMA>AD Design</SCHEMA> > <NAME>AD_FILES_N1I</NAME> > </INDEX> > <INDEX version="1.0" xmlns:doc="http://xmlns.oracle.com/ku"> > <SCHEMA>AD Design</SCHEMA> > <NAME>AD_FILES_N1I</NAME> > </INDEX> > </ROWSET> > </ROW> > > xsl File > > <?xml version='1.0' encoding='utf-8' ?> > <xsl:stylesheet > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="1.0"> <xsl:output method="xml"/> <xsl:template > match="/ROWSET"> <xsl:apply-templates select="ROW/INDEX"/> > </xsl:template> <xsl:template match="ROW/INDEX"> <xsl:copy-of > select="."/> </xsl:template> </xsl:stylesheet> > > > O/P xml: > > <?xml version="1.0" encoding="UTF-8"?> > <INDEX version="1.0" > > <SCHEMA>AD Design</SCHEMA> > <NAME>AD_FILES_N1I</NAME> > </INDEX>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xmlns attr for element no, David Carlisle | Thread | [xsl] tag and attribute statistics , fatma helmy |
Re: [xsl] xmlns attr for element no, David Carlisle | Date | Re: [xsl] using xsl:message with UT, Andrew Welch |
Month |