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

how to reflect on the namexpaces URIs and prefixes in

Subject: how to reflect on the namexpaces URIs and prefixes in XSLT?
From: Gunther Schadow <gunther@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 11 Feb 2002 11:43:47 -0500
how to reflect
Hi,

I am working on a XSLT dealing with XML Schemas. I generate
certain Schema thingies, like complexType and simpleType
and other elements. Within those, I need to deal properly
with the XML Schema "targetNamespace". For instance, if
the ancestor schema node of the input document has this

<xsd:schema
  xmlns:xsd='http://www.w3.org/2001/XMLSchema'
  xmlns:v3dt='urn::hl7.org/v3dt'
  targetNamespace='urn::hl7.org/v3dt'>

now if I generate a xsd:complexType definition for a type
called 'foo' I will generate:

<xsd:complexType name='foo'/>

if I refer to such types defined in the schema, I have to
do something like this:

<xsd:element name='thing' type='v3dt:foo' />

Now the questions:

- how do I query for the active namespace prefix declarations
  in the input document?

  Apparently (in saxon at least) the document that I can see
  with <copy-of select='$root'/> where <xsl:variable name='root'
  select='/'/> doesn't contain any xmlns:... attributes, at least
  not at the point of my XSLT execution where I need them.

- even if I find those xmlns:... attributes (which I do, sort of,
  in the root template of the XSLT), how do I query those? I can see
  the xslns attributes show up when I do

<xsl:copy-of select='$root//xsd:schema'/>

  but as soon as I'm trying to grab them specifically, e.g.,
  using:

<xsl:for-each select='$root//xsd:schema/@*'/>

  I'm not seeing any of the xmlns ones. They only show up if
  anything is actually using the namespace in the output, but
  how do I know what namespace prefix the xsd:schema/@targetNamespace
  is bound to?

It sounds like XSLT is making namespace prefix declarations a
special thing (which is O.K.) but it doesn't provide any special
mechanisms by which one could dynamically work with the namespaces
used by an input document. Are there any workarounds?

thanks,
-Gunther

--
Gunther Schadow, M.D., Ph.D.                    gschadow@xxxxxxxxxxxxxxx
Medical Information Scientist      Regenstrief Institute for Health Care
Adjunct Assistant Professor        Indiana University School of Medicine
tel:1(317)630-7960                         http://aurora.regenstrief.org



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


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.