xsl-list
[Top] [All Lists]

RE: [xsl] Templates for different kinds of tags?

2007-03-22 11:39:18

You can do all of this with template rules, you don't need xsl:choose at
all. Write rules like


<xsl:template match="table[(_at_)style='simple']">
 
<xsl:template match="table[(_at_)style='simple']/tr">

<xsl:template match="table[(_at_)style='simple']/tr/td">

to process the different kinds of element in your input.

Michael Kay
http://www.saxonica.com/

-----Original Message-----
From: Thomas Zastrow [mailto:listen(_at_)thomas-zastrow(_dot_)de] 
Sent: 22 March 2007 18:19
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Templates for different kinds of tags?

Hi there,

I'm not so familiar with XSL, please be patient ;-)

I have a XML-document (not HTML) with tables like this:

<table>
<tr>
<td></td><td></td>
</tr>
</table>

So, I have three templates for them:

<xsl:template match="table">
<xsl:template match="tr">
<xsl:template match="td">

Now, I want to use different kinds of tables in my XML-doc like

<table style="simple">
<table style="xyz">

Depending on the style-attribut, I can change the 
template-code for <table> with  xsl:choose. But, the <tr>- 
and <td>-tags are still the same code, so, they will always 
use the same templates. But I also want to change the code 
for tr and td, depending on the style of the complete table.

Is this possible or have I to write the xsl:choose - 
statement again in the tr- and in the td-templates?

Thank you!

Best,

Tom


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--