[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Namespace(?) question

Subject: Namespace(?) question
From: <sthomas2@xxxxxxx>
Date: Wed, 7 Mar 2007 09:08:06 -0500
 Namespace(?) question
Sorry to bother everyone with a question whose answer is probably in the
FAQ, but I couldn't find it there.

My input document (which happens to be a schema) has the following form:


<xs:schema
 xmlns:xs="http://www.w3.org/2001/XMLSchema"
 xmlns:pfx="http://my.url"
 targetNamespace="http://my.url"
 elementFormDefault="qualified">

  <xs:complexType name="ChildClass">
    <!-- details omitted ->
  </xs:complexType>

  <xs:element name="ParentClass">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Property" type="pfx:ChildClass"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>


As part of its processing, my transform needs to identify all
complexType nodes that are referenced as types elsewhere in the
document. In the example above, I need to identify ChildClass because it
is a complexType that is referenced by the "type" attribute within the
ParentClass.

I would expect the following to work:

<xsl:template match="/">
  <xsl:for-each
select="(*/xs:simpleType|*/xs:complexType)[//@type=@name]">
    <!-- do something useful ->
  </xsl:for-each>
</xsl:template>


But, at least with Saxon6.5.5 it selects nothing. It seems like a
namespace problem, since removing pfx: from the type (and defining a
default namespace) makes the transform work as I expect it to. I suppose
I could play around with local-name() and get the transform to work, but
that doesn't seem like the right approach. I was thinking (hoping?) that
XSL would handle the namespace resolution automatically, but clearly I
am wrong. Or perhaps my select is wrong, and it just happens to work by
coincidence without namespace prefixes. In any case, I would welcome
enlightenment.

Many thanks for your patience and thanks in advance for any assistance,

Stephen

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.