Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] removing unecessary attributes

From: Andreas Peter <info@---------->
To:
Date: 4/1/2008 7:53:00 PM
Thanks for the hint about HTML tidy. That works.



Andreas



Mukul Gandhi schrieb:
Your input is not a well-formed XML. Because attributes are not
enclosed in quotes.

Following approaches quickly come to my mind to handle this.



1) An XSLT process cannot get this input as a data model tree, as a
result of XML parsing. Because XML parser will reject this input.
One approach can be, you can use the XSLT 2.0 function, unparsed-text
to read this input as a string and then parse it by hand and do the
transformation you need. But this will not be trivial.

2) Make the input a well-formed XML. Doing this by hand could be
tedious. So you could use a tool like, HTML tidy
(http://tidy.sourceforge.net/).
After you get a well-formed XML as an input, then writing the XSLT
stylesheet for this requirement is quite easy. A modified identity
stylesheet will work here, easily.


On Tue, Apr 1, 2008 at 10:56 PM, Andreas Peter <info@xxxxxxxxxx> wrote:

  
Hello list-users,



 I have the following file. The problems are the missing quotes for the
 attributes values and
 I need to remove all of the attributes.

 <table>
  <tr class=xl33 height=17 style='height:12.75pt'>
  <td height=17 class=xl37 style='height:12.75pt'>*00.09.1939</td>
  <td class=xl37>&nbsp;</td>
  <td class=xl38>KM<span style="mso-spacerun: yes"> </span>111</td>
  <td class=xl39 x:num>42</td>
  <td class=xl40 x:num>412</td>
  <td colspan=2 class=xl40 style='mso-ignore:colspan'>&nbsp;</td>
  <td class=xl40>Tender</td>
  <td class=xl40>&nbsp;</td>
  <td class=xl40>PL</td>
  <td class=xl40>&nbsp;</td>
  <td colspan=5 class=xl39 style='mso-ignore:colspan'>&nbsp;</td>
  <td class=xl38>Hela</td>
  <td class=xl39>&nbsp;</td>
  <td colspan=238 class=xl33 style='mso-ignore:colspan'>&nbsp;</td>
  </tr>
 </table>

 I know how to copy the tree and so on but the problems are the missing
 quotes.
 I get the error message "Open quote is expected for attribute "class"
 associated with an element type "tr".

 Using XSLT is it possible to create an output like the follownig?



 <table>
  <tr>
  <td>*00.09.1939</td>
  <td>&nbsp;</td>
  <td>KM 111</td>
  <td>42</td>
  <td>412</td>
  <td>&nbsp;</td>
  <td>Tender</td>
  <td>&nbsp;</td>
  <td>PL</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  <td>Hela</td>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  </tr>
 </table>

 Thanks for every hint,
 Andreas


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent