[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: matching on several elements, but determine which

Subject: Re: matching on several elements, but determine which was matched
From: "Roger Chi" <roger.xslt@xxxxxxxxxxxx>
Date: Thu, 20 Oct 2005 11:50:28 -0400
xsl template match several elements
You could do something like:

<xsl:template match="h1|h2|h3|h4|h5|h6">
  <xsl:element name={concat('title',substring(name(),2,1))}">
    <xsl:text>HTML Heading</xsl:text>
  </xsl:element>
</xsl:template>

On 10/20/2005, "Dominik Zayer" <dzayer@xxxxxxxxxxxxxx> wrote:

>Hi
>
>I have some very similar XML elements (html headings) which produce very
>similar XSLT output. Know i'm wondering if i could use some wildcards to
>tauten my code.
>
>Here's a part of the XSLT to get you an idea what i am talking about:
><xsl:template match="h1">
>        <title1>HTML Heading</title1>
></xsl:template>
><xsl:template match="h2">
>        <title2>HTML Heading</title2>
></xsl:template>
>....and so on till <h6>...
>
>Is it possible to do something like:
><xsl:template match="h1|h2|h3|h4|h5|h6">
>	#determine which element was matched and write the according output
>element#
></xsl:template>
>
>the matching seems to work this way, but i don't have a clue how to
>output the correct tag...
>
>Thanks for help, hints or a kick in the ass (if this question is really
>stupid) ;)
>
>Best,
>Dominik
>
>
>
>--
>Dominik Zayer  > Development
>iconmobile GmbH > Methfesselstr. 32-36 > D-10965 Berlin
>phone +49 30 789 519 13 > fax +49 30 890 686 50
>dzayer@xxxxxxxxxxxxxx > http://www.iconmobile.com

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.