transformation: element tag-name to attribute value

Subject: transformation: element tag-name to attribute value
From: Ed Nixon <ed.nixon@xxxxxxxxxxxxxxxxx>
Date: Mon, 26 Oct 1998 14:24:22 -0500
Let's say I have a rule:

<xsl:template match="section1|section2|section3|section4|section5|section6">
  <div class="section1"><xsl:process-children/></div>
</xsl:template>

Now. Rather than creating an output document that contains div with every class 
equal to "section1", I want to create div with class "section?" dependant on 
the particular match alternative that is activated while running through the 
source document.

1. Is there a syntax, such as section? that acts as a single character 
'wild-card' in the match statement?
2. What is the syntax for the right-hand side of the class= statement such that 
the matched element type name is inserted?

I *have* looked at the draft but it doesn't pop out at me.

I realize there are probably alternative and better design solutions for this 
specific instance of the problem, e.g., relying on source attribute values to 
carry the numeric (ordering) information, etc., but the more general problem of 
getting the tag name into the output document's attribute set is what I'm 
trying to understand.

Thanks for your help.			...edN


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


Current Thread