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

matching on namespaces, whitespace handling

Subject: matching on namespaces, whitespace handling
From: "Wilson, James.W" <James.W.Wilson@xxxxxxxxxxxxx>
Date: Fri, 11 Jun 1999 17:35:56 -0500
murky.com
after banging on XSL (using the latest XT) quite a bit, I have some
questions for the gurus.

1. I don't understand the relationship between the names in the template
'match' attributes, the namespaces defined in the input document, and the
namespaces defined in the stylesheet. Perhaps it's somewhere in the spec,
but I can't seem to find it.

suppose I have a document

<myns:mystuff
	xmlns:html='http://www.w3.org/TR/REC-html40'
	xmlns:mystuff='http://www.murky.com/mystuff'
	>
	<myns:foo>
		<html:a href='bar'>See bar</html:a>
	</myns:foo>
</myns:mystuff>

how should I match elements in a given namespace? I understand that one can
do <xsl:template match='html:*'>, but do I have to define the 'html:*' and
'myns:*' namespaces in my XSL stylesheet if I want to match elements in
those namespaces? Do I have to make sure that I use the same prefix as in
the input document? What if someone uses 'myhtml:*' as the html prefix? 

It would be very helpful to find a document, ideally a big bold portion of
the spec, which explains how the XSL processor should match input elements
with namespace prefixes. Does the processor match 'html:*' using the URI of
the namespace 'html' defined *in the stylesheet*? does it match using the
qname in the original input? 

2. How do I find all the namespaces that are defined on a node? With the
namespace() function I can find *the* namespace of a node, but I can't
figure out how to get *all* defined namespaces.

3. When producing html output, I often want to control exactly how much
space is produced between different parts of the result tree. When I want to
strip out excess space, I can use strip-space='yes' or xml:space='default' -
BUT this seems to mean 'strip out all but one space' to XT. If I want *no*
spaces, I have to do something like

<xsl:template match='foo'>
	<xsl:for-each select='bar'
		xml:space='preserve'
		><a href='{@id}
		><xsl:value-of select='baz'
		/></a></xsl:for-each>
</xsl:template>

which is hardly a model of readability. ;) Is there another way to
accomplish this (seemingly trivial) task in a less cramped way?

tia,
James


 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.