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

		<html:a href='bar'>See bar</html:a>

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'
		><a href='{@id}
		><xsl:value-of select='baz'

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


 XSL-List info and archive:

Current Thread