xml editor

Products

Features

  EPUB
Supported platforms

Supports Windows 7 & Mac OS X Lion

Ready for XML Editor data server software
W3C Member

xml cleaning and attribute removing

Questions about XML that are not covered by the other forums should go here.

xml cleaning and attribute removing

Postby lux » Wed Jul 18, 2007 5:46 pm

hi!

i would like to edit an xml file in the following way:

delete certain attributes in the whole document at once
(or maybe export needed content to a new file)

the info looks like this:

<Placemark>
<description>&lt;table style='width:100%'&gt;&lt;tr valign='top'&gt;&lt;td align='justify'&gt;Eresin Crown Hotel is located in Sultanahmet, the heart of Istanbul's historical part, adjacent to the tourist, business, entertainment and shopping areas.&lt;br /&gt;&lt;br /&gt;In order to admire Istanbul's museums and architectural wonders you do not need to stay in line and wait... In addition to the personalised quality service and comfort; we have created for you in the Eresin Crown Hotel a private museum comprising a cistern, mosaic and 49 historical and architectural extraordinary museum pieces from the Hellenistic and Byzantine time. All of these historical and architectural heritage pieces are officially registered by the archaelogical museum of Istanbul. &lt;br /&gt;&lt;br /&gt;&lt;a target=_blank href='http://www.mashedhotels.com/60086045' &gt;More Information&lt;/a&gt;&lt;/td&gt;&lt;td style='padding-left:8px;paddding-bottom:8px; align=right&gt;&lt;a target=_blank href='http://www.mashedhotels.com/60086045' &gt;&lt;img src='http://www.mashedhotels.com/img/45/60086045n.jpg' title="Eresin Crown Hotel" alt='' &gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</description>
<name>Eresin Crown Hotel</name>
<LookAt>
<longitude>28.97226</longitude>
<latitude>41.00419</latitude>
<range>0</range>
<tilt>0</tilt>
<heading>3</heading>
<coordinates>28.97226,41.00419,0</coordinates>
</LookAt>
<Point>
<coordinates>28.97226,41.00419,0</coordinates>
</Point>
<address> Istanbul, Istanbul 344 00, Turkey</address>
</Placemark>

i want to get this result:

<Placemark>
<name>Eresin Crown Hotel</name>
<coordinates>28.97226,41.00419,0</coordinates>
<address> Istanbul, Istanbul 344 00, Turkey</address>
</Placemark>

i didnt find any export solution to select wich attributes should be skipped..

is it possible to do such an export in oxygen?

many thanks!
lux
lux
 
Posts: 3
Joined: Wed Jul 18, 2007 5:32 pm
Location: switzerland

Postby jkmyoung » Wed Jul 18, 2007 8:27 pm

Simply create a filter on your Placemark template to only copy the information you need:
<xsl:template match="Placemark">
<xsl:copy>
<xsl:copy-of select="name|LookAt/coordinates|address"/>
</xsl:copy>
</xsl:template>
jkmyoung
 
Posts: 89
Joined: Mon Mar 06, 2006 10:13 pm

Postby lux » Wed Jul 18, 2007 11:23 pm

ok that looks promising! tnx :)

actually i found sort of a filter, but its only used to "hide" attributes and i dont exactly understand where i have to put that information in you sent me.

is this a transformation i have to execute in "document"->"transformation" ?

tnx again!

lux
lux
 
Posts: 3
Joined: Wed Jul 18, 2007 5:32 pm
Location: switzerland

Postby sorin » Thu Jul 19, 2007 4:52 pm

Hello,

Yes, it is a transformation which you execute with the action Document -> Transformation -> Apply Transformation Scenario. The same action is available on the Transformation toolbar. You define a transformation scenario with the action Configure Transformation Scenario. You apply the scenario with the action Apply Transformation Scenario.


Regards,
Sorin
sorin
 
Posts: 3228
Joined: Fri Mar 28, 2003 2:12 pm

Postby lux » Sat Jul 21, 2007 5:46 pm

ok!

so i configured the transformation, used the file i wish to transform as input and the above stated code in a xsl-file stored as xslt

result:
F [Saxon6.5.5] The prefix "xsl" for element "xsl:template" is not bound.


my knowledge about xml and the like seems very limited i guess now ;)
lux
 
Posts: 3
Joined: Wed Jul 18, 2007 5:32 pm
Location: switzerland

Postby sorin » Mon Jul 23, 2007 11:09 am

Hello,

The xsl prefix is for the XSLT namespace and should be declared on the root element of the XSLT stylesheet:

Code: Select all
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">


You should read an XSLT tutorial.


Regards,
Sorin
sorin
 
Posts: 3228
Joined: Fri Mar 28, 2003 2:12 pm


Return to General XML Questions

Who is online

Users browsing this forum: No registered users and 0 guests

XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2011 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>® XML Editor