xsl-list
[Top] [All Lists]

RE: [xsl] XPath Expression in XSL Template Will Not Return Document Element with Attributes‏

2009-02-09 18:15:59
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(_at_)msn(_dot_)com] 
Sent: 09 February 2009 22:04
To: XSL List
Subject: [xsl] 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.

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



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