Sponsored Content
Top Forums Shell Programming and Scripting Removing unwanted tags from xml file Post 302569572 by fpmurphy on Monday 31st of October 2011 08:04:22 PM
Old 10-31-2011
Here is an XSL stylesheet that does what you want.
Code:
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:output omit-xml-declaration="yes" indent="yes"/>
    <xsl:strip-space elements="*"/>

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

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

</xsl:stylesheet>

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Removing leading and trailing spaces of data between the tags in xml.

I am having xml document as below. <transactionid> 00 </transactionid> <tracknumber> 0 </tracknumber> <key> N/A </key> But the data contains leading and trailing spaces between the tags. Please let me know how can i remove these leading and trailing spaces between the tags.... (2 Replies)
Discussion started by: jhmr7
2 Replies

2. Shell Programming and Scripting

Remove unwanted XML Tags

I have set of sources and the respective resolution. Please advice how to resolve the same using Unix shell scripting. Source 1: ======= <ext:ContactInfo xmlns:ext="urn:AOL.FLOWS.Extensions"> <ext:InternetEmailAddress>AOL@AOL.COM</ext:InternetEmailAddress> </ext:ContactInfo> Resoultion... (1 Reply)
Discussion started by: ambals123
1 Replies

3. UNIX for Dummies Questions & Answers

Removing spaces between XML tags<XX XX> -> <XXXX>

hey guys, i have an XML like this: <documents> <document> <Object ID>100114699999</Object ID> <Object Create Date Time>2008-04-07T00:00:00</Object Create Date Time> </document> <documents> I need all my tags within the XML to not include any spaces. i.e. everything between <t a g> in... (8 Replies)
Discussion started by: sharoff
8 Replies

4. Shell Programming and Scripting

Help in removing xml tags

Hi, I have a input xml file like this <postalAddress:>379 PROSPECT ST </postalAddress:> <street:>STE B </street:> <l:>TORRINGTON </l:> <st:>CT</st:> <postalCode:>067905238</postalCode:>... (5 Replies)
Discussion started by: pintoo
5 Replies

5. Shell Programming and Scripting

removing unwanted characters from a file

i have a file like this 1111_2222#$#$dudgfdk 11111111_343434#$#$334 1111_22222#43445667 i want to remove all those charachetrs from # how can i do this Thank in advance Saravanan (4 Replies)
Discussion started by: saravanan71184
4 Replies

6. Shell Programming and Scripting

Filter a .kml file (xml) to remove unwanted entries

Ok, i have a .kml file that that i want to trim down and get rid of the rubbish from. its formatted like so: <Placemark> <name><!]></name> <description><!</b><br/>Frequency: <b>2437</b><br/>Timestamp: <b>1304892397000</b><br/>Date: <b>2011-05-08... (11 Replies)
Discussion started by: Phear46
11 Replies

7. Shell Programming and Scripting

How to add the multiple lines of xml tags before a particular xml tag in a file

Hi All, I'm stuck with adding multiple lines(irrespective of line number) to a file before a particular xml tag. Please help me. <A>testing_Location</A> <value>LA</value> <zone>US</zone> <B>Region</B> <value>Russia</value> <zone>Washington</zone> <C>Country</C>... (0 Replies)
Discussion started by: mjavalkar
0 Replies

8. Shell Programming and Scripting

Removing extra unwanted spaces

hi, i need to remove the extra spaces in the filed. Sample: abc~bd ~bkd123 .. 1space abc~badf ~bakdsf123 .. 2space abc~bqed ~bakuowe .. 3space output: abc~bd ~bkd123 .. 1space abc~badf~bakdsf123 .. 2space abc~bqed~bakuowe .. 3space i used the following command, (2 Replies)
Discussion started by: anshaa
2 Replies

9. Shell Programming and Scripting

Removing extra unwanted spaces

hi, i need to remove the extra spaces in the 2nd field. Sample: abc|bd |bkd123 .. 1space abc|badf |bakdsf123 .. 2space abc|bqe |bakuowe .. 3space Output: abc|bd|bkd123 abc|badf|bakdsf123 abc|bqe|bakuowe i used the following command, (9 Replies)
Discussion started by: anshaa
9 Replies

10. UNIX for Beginners Questions & Answers

Removing unwanted symbols with sed

I would like produce blue, green, red, yellowfrom"blue:,*green:,*red:,*yellowI can remove the colon with echo "blue:,*green:,*red:,*yellow" | sed 's/://g'which givesblue,*green,*red,*yellowbut when I try echo "blue:,*green:,*red:,*yellow" | sed 's/://g'; 's/*//g'I get bash: s/*//g: No such... (9 Replies)
Discussion started by: Xubuntu56
9 Replies
MEINPROC4(8)							 KDE User's Manual						      MEINPROC4(8)

NAME
meinproc4 - KDE translator for XML SYNOPSIS
meinproc4 [--help] [Generic-options] [Qt-options] [KDE-options] [--cache file] [--check] [--htdig] [--srcdir] [--param key=value] [[-o | --output] file] [--stdout] [--stylesheet xsl] docbook_file DESCRIPTION
meinproc4 converts DocBook files to HTML. GENERIC OPTIONS
--author Show author information. --help Show help about options. --help-all Show all options. --help-kde Show KDE specific options. --help-qt Show Qt specific options. --license Show license information. -v--version Show version information APPLICATION OPTIONS
--cache file Create a cache file for the document --check Check the document for validity The output can be a bit daunting, since one small mistake can cause a cascade of errors. The trick is to look at the first error, fix that error, save the file, and run meinproc4 again. --htdig Create a ht://dig compatible index -o, --output file Output whole document to file. --stdout Output whole document to stdout. --stylesheet xsl Stylesheet to use --srcdir dir Set the root directory to look for kdelibs --param key=value Set parameters to pass to the stylesheet. USAGE
The most common way to run meinproc4 is simply as meinproc4 docbook-file where docbook-file is usually index.docbook. This command creates HTML pages from the DocBook file. Note that these pages are only view- able in KDE-based browsers (like Konqueror). If you need to view the HTML output in another browser (for example, if you're placing it on line), use meinproc4 --stylesheet stylesheet-name docbook-file where stylesheet-name is the full path to one of the XSL stylesheets in $KDEDIR/share/apps/ksgmltools/customization. To produce output suitable for the web, you can use kde-web.xsl or kde-chunk-online.xsl. See the README file in that directory for more details. SEE ALSO
kdeoptions(7), qtoptions(7) BUGS
There are probably tons of bugs. Use bugs.kde.org: http://bugs.kde.org to report them. 2008-10-03 MEINPROC4(8)
All times are GMT -4. The time now is 11:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy