XML n00b- need to delete a large number of tags

Questions about XML that are not covered by the other forums should go here.
sibyl
Posts: 1
Joined: Thu May 07, 2009 4:13 pm

XML n00b- need to delete a large number of tags

Post by sibyl »

Hi there,

I need to delete a lot of tags from a large XML file. The thing is, they all have different text in them. This is part of the file:
<c id="ref8427" level="file">
<did>
<unittitle>The History of Arrowroot Production in Barbados and the Chalky Mount Arrowroot Growers' Association: A Peasant Marketing Experiment that Failed</unittitle>
<unitid>RISM 20047</unitid>
<container type="item">20047</container>
<physdesc>
<extent>p. 131-152.</extent>
</physdesc>
<unitdate normal="1965/1965">November 1965</unitdate>
<physloc id="ref8429" label="Location note"></physloc>
<origination label="creator">
<persname source="ingest">Handler, Jerome S.</persname>
</origination>
</did>
<odd id="ref8428">
<head>General note</head>
<p>Original marc record data: MARC Leader: 00455nam ref9200109u 4500   100-1- a: Handler, Jerome S.   245-1-4a: The History of arrowroot production in Barbados and the Chalky Mount Arrowroot Growers' Association:   b: a peasant marketing experiment that failed.   300- - a: p. 131-152.   650- -4a: Arrowroot   z: Barbados.   730-4-1a: The Journal of the Barbados Museum and Historical Society,   n: vol. 31, no. 3, November 1965.   852- - h: VF   p: 20047   961-W-Lt: 36   u: February 2000  </p>
</odd>
<controlaccess>
<subject source="ingest">Arrowroot</subject>
<subject source="ingest">Barbados</subject>
</controlaccess>
</c>

I need the <unitid> tag deleted. Any idea on how to do this?

Thanks!!
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: XML n00b- need to delete a large number of tags

Post by sorin_ristache »

Hello,

You have to find a common feature of all the elements that you want to remove from the XML file. When you have this rule you can write an XSLT stylesheet that removes all the elements that match your rule.


Regards,
Sorin
Post Reply