[xsl] xsl:apply-templates behaving differently depending on the node copied?

Subject: [xsl] xsl:apply-templates behaving differently depending on the node copied?
From: knocte <knocte@xxxxxxxxx>
Date: Wed, 11 May 2005 13:25:51 +0200
Hello.

I need to use xsl:apply-templates but I want it to behave in some way
when it comes to copy a predefined tag in special circumstances, can
it be done? Let me explain:

I already have a XSLT file that will parse this XML file:

<page>
  <head>
    <title>Example</title>
  </head>

  <content>
    <h1>Example</h1>
    <table>
      <tr>
        <td></td>
        <td>Something #1</td>
      </tr>
      <tr>
        <td>Somthing #2</td>
        <td />
      </tr>
    </table>
  <content>
</page>


And it will convert it to the following:

<html>
  <head>
    <title>Example</title>
  </head>
  <body>
    <div id="content">
      <h1>Example</h1>
      <table>
        <tr>
          <td></td>
          <td>Something #1</td>
        </tr>
        <tr>
          <td>Something #2</td>
          <td />
        </tr>
      </table>
    </div>
  <body>
</html>


Using:

[...]
<div id="content">
  <xsl:apply-templates select="content/*" />
</div>
[...]


But how can I use apply-templates to obtain the following?:

<html>
  <head>
    <title>Example</title>
  </head>
  <body>
    <div id="content">
      <h1>Example</h1>
      <table>
        <tr>
          <td>________NOTHING!_______</td>
          <td>Something #1</td>
        </tr>
        <tr>
          <td>Something #2</td>
          <td>________NOTHING!_______</td>
        </tr>
      </table>
    </div>
  <body>
</html>



Thanks in advance.

	Andrew

--

Current Thread