Re: [xsl] multiple documents, namespaces and the same structure

Subject: Re: [xsl] multiple documents, namespaces and the same structure
From: Dan Vint <dvint@xxxxxxxx>
Date: Wed, 10 Jan 2001 11:33:21 -0800 (PST)
I'll take a look at this and see if it does the job.

- Strange output - this was just a quick sample to show what I ws having
troubles with, I'm actaully sending this all out to HTML anyway

- use of namespace - I don't know I just work here! ;-) Take a look at the
whitepaper on iLingo at www.lexica.net for how these were designed. Esentially
we broke the design into objects that surrounded people, insurance lines
of business, accounts, etc. We used the names spaces for these larger objects,
one for each, but within an account there is  a business address and the people
assocaited with the account also had their own addresses. Anyway that was what
lead to this design/configuration.

..dan

> 
> 
> Equivalent to what you said you had would be
> 
> <xsl:for-each 
>   select="//*[local-name(.)='business']/*[local-name(.)='us.address']">
> 
> 	<xsl:value-of select="."/>
> 	<xsl:value-of select="@address.type"/>
> 	<!-- see below <xsl:value-of select="*[local-name(.)='street']"/>-->
> 	<xsl:value-of select="street"/>
> 
> </xsl:for-each>
> 
> which would work for any namespace as long as the local names were as
> given. 
> 
> but that would seem to produce a strange output.
> 
> Given
>           <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"/> 
> 	 </us.address> 
> 
> your 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"/>
> </xsl:template>
> 
> surely produces
> 
> 222 Kearney St.Suite 500San FranciscoCAstreet222 Kearney St.Suite 500
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> $address.node
>                                        ^^^^^^
>                                        $address.node/@address.type
>                                              ^^^^^^^^^^^^^^^^^^^^^^^^^
>                                              $address.node/street
> 
> As you can see, you can use local-name() to make a template apply to any
> namespace, but if these address constructs mean the same thing in
> different files why are they in different namespaces? It would be more
> in the spirit of the game if you placed common elements in a common
> namespace. 
> 
> Oh actually you don't get the street name twice, as 
> <xsl:value-of select="$address.node/street"/>
> presumably never selects anything as there isn't an element street in
> the null namespace. it's always in the namespace attatched to (for
> example) commercial: 
> 
> so your example produces
> 
> 222 Kearney St.Suite 500San FranciscoCAstreet
> 
> no?
> 
> 
> David
> 
> _____________________________________________________________________
> This message has been checked for all known viruses by Star Internet delivered
> through the MessageLabs Virus Control Centre. For further information visit
> http://www.star.net.uk/stats.asp
> 


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


Current Thread