RE: XPath Expression in XSL Template Will Not Return D
Firstly, you need to understand that namespace declarations are not attributes when processed in XSLT or XPath. They have similar syntax in surface XML, but they are quite distinct animals in the data model. You said there were three "attributes pertaining to namespaces" on the Catalog element, but you only showed two of them. Perhaps the third was a default namespace declaration, xmlns="....something...". Such a declaration changes the name of the element. An element name is a (namespace, local-name) pair, and this would make the element name ("...something...", "Catalog"), so a select for ("", "Catalog") would not match the element. Google for "XSLT default namespace" for more information. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: Joshua Glenn [mailto:joshglenn1@xxxxxxx] > Sent: 09 February 2009 22:04 > To: XSL List > Subject: XPath Expression in XSL Template Will Not > Return Document Element with Attributes~ > > > Listmembers, I have a problem creating an appropriate XPath > expression in a XSL file, and have been unable to find a > solution. Here the Scenario: I have an xml file output from > asp.net xmlserializer class. It outputs the Document Element > "Catalog" with three attributes pertaining to XML namespaces. > > the catalog tag looks like this (markup removed): > > Catalog > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > > I have created an XSL file to restructure the information for > use in a ASP.NET GridView Control. > > xsl:template match="/" > xsl:apply-templates select="Catalog" > xsl:template> > > It works, but only if I remove the attributes from the > Element. I need to know how to format the xsl:template > match="Catalog" xpath expression in the XSL file to match > that tag, even if it has attributes. > > This is my first post to this list. I hope this is a resource > that will be helpful, and as I become more proficient in > XPath and XSL, I'll be able to help others. > > Thanks in advance.
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format