Reproduce all attributes in XML conversion using XSLT

I try to convert XML to XHTML using XSLT. The XML code provided contains tables, with attributes that I have to reproduce :

XML Code :

...
<table>
  <tr>
    <td width="70" valign="middle" align="center">
       Hi 
    </td>
    <td width="95" valign="middle" align="center">
       Ho 
    </td>
    <td width="130" valign="middle" align="center">
       Hu 
    </td>
  </tr>
  <tr>
    <td width="70" valign="middle" align="center" class="text1">
       hihihi
    </td> 
    <td width="95" valign="middle" align="right" class="text1">
       hohoho
    </td> 
    <td width="130" valign="middle" align="center" class="text1">
       huhuhu
    </td> 
  </tr>
</table>
...

For now, I use that XSL code :

...
<xsl:template match="table">
<table><xsl:apply-templates /></table>
</xsl:template>

<xsl:template match="tr">
<tr><xsl:apply-templates /></tr>
</xsl:template>

<xsl:template match="td">
<td><xsl:apply-templates /></td>
</xsl:template>
...

Any idea about reproducing all cells attributes ?

Answers


Use:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" indent="yes"/>

  <xsl:template match="table | tr | td">
    <xsl:copy>
      <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="@*">
    <xsl:copy>
      <xsl:apply-templates select="@*"/>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>

Need Your Help

How to specify a model in a default_scope?

ruby-on-rails ruby model scope

My model Chapter has_many Pages, which in turn belong_to only one Chapter. I'm trying to do the following joins:

Instagram API custom image width

php instagram

I am trying to set custom width for images in Instagram, using Instagram API. I am using hashtag to grab all images related. Can I ask Instagram to serve me custom image sizes? I know there are 3 s...