RE: [xsl] How to address generic unknown elements !

Subject: RE: [xsl] How to address generic unknown elements !
From: "Américo Albuquerque" <aalbuquerque@xxxxxxxxxxxxxxxx>
Date: Thu, 14 Nov 2002 19:23:01 -0000
Hi Delaney

Try this (is not very diferent from yours):

<xsl:template match="/">
 <xsl:for-each select="*//*[not(*)]">
  <xsl:value-of select="local-name()"/>
 </xsl:for-each>

 <xsl:for-each select=".//*[not(*)]">
  <xsl:value-of select="node()"/>
 </xsl:for-each>
</xsl:template>

Hope that this helps.

-----Original Message-----
From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Delaney
Robin
Sent: Thursday, November 14, 2002 1:27 PM
To: 'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'
Subject: AW: [xsl] How to address generic unknown elements !



I'll try and simplify. Complicated version (sorry Agnes :-) ) in my
previous mail.

XML:
		<ABC>       			1st level
			<BCD>			2nd level
				<EFG>123</EFG>  lower levels
			</BCD>
			<BCD>
				<EFG>456</EFG>
			</BCD>
		</ABC>

and without knowing the tag names try to get
1) tag-names for descendants of the 2nd level tag (in this case BCD)
which don't themselves have descendants (ie. the lowest level in the
hierarchy).
Result: EFG  (but only one time)
2) the values of all tags that don't have descendants. Result: 123 456
(i think this bit is OK)

What I'm getting is: EFGEFG 123456
What I want is: EFG 123456


Obviously because of the for-each which iterates 2 times.  How do I
limit it to 1st Occurrance of my "level-2" tag and it's decendants. Can
I have two template matches and how would I describe the path ?

	<xsl:template match="/">
			<xsl:for-each select="?//*[not(*)]">
???stuck
here???
				<xsl:value-of select="local-name()"/>
			</xsl:for-each>

			<xsl:for-each select=".//*[not(*)]">
Getting
Values OK
				<xsl:value-of select="node()"/>
 	  	</xsl:template>

Hopefully a bit clearer !

Thanks in advance,

Robin

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



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


Current Thread