[xsl] multiple documents, namespaces and the same structure

Subject: [xsl] multiple documents, namespaces and the same structure
From: Dan Vint <dvint@xxxxxxxx>
Date: Wed, 10 Jan 2001 10:18:14 -0800 (PST)
I have an application that is made up of several small documents that each 
have a DTD and their own namespace assignments. These documents all work 
together and are linked via an attribute (href) that has the name of the
document file.

Within several of these I have a common address structure. Currently,
I process each document and address structure vi document() and then use
something like commercial:street or alob:street to format these documents.

What I want to do is create a standard template that I could pass the whole
address structure into and have it format everything. I beleive I'm being hung 
up on the namespace names. If I take a simple version of the template it would
be like this:

Here is the call:

<xsl:for-each select="//commercial:business/commercial:us.address">
	<xsl:call-template name="format.address">
		<xsl:with-param name="address.node" select="."/>

the template:

<xsl:template name="format.address">
<xsl:param name="address.node"/>
	<xsl:value-of select="$address.node"/>
	<xsl:value-of select="$address.node/@address.type"/>
	<xsl:value-of select="$address.node/street"/>

Data looks like:

	 <us.address address.type="street"> 
		<street>222 Kearney St.</street> 
		<street>Suite 500</street> 
		<city>San Francisco</city> 
		<state>CA</state><zip main="94108" sub="1234"/> 

This template will output:

222 Kearney St.Suite 500San FranciscoCA
<<nothing here for the third item>>

Any idea on how to set this up? I have other templates that I use generically 
but I pass in specific values so I don't have the same problem. I suppose I 
could do that here, but that would require changing every call to this template
if a new attribute or element is added to address - workable but not pretty.


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

Current Thread