Sponsored Content
Top Forums Shell Programming and Scripting Shell script for XML code parsing. Post 302520910 by fpmurphy on Monday 9th of May 2011 02:30:47 PM
Old 05-09-2011
Here is an XSL stylesheet which does what you specified in your first post. In addition it does not output output newlines for empty elements.
Code:
<xsl:stylesheet version="1.0"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="text"/>

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

<xsl:template match="node()">
   <xsl:if test="string(.)">
      <xsl:copy>
          <xsl:apply-templates select="node()"/><xsl:text>
</xsl:text>
      </xsl:copy>
   </xsl:if>
</xsl:template>

</xsl:stylesheet>

Code:
13-WY-8425-2
WY84252
F
0005
13
04/12/2012
282.00
131533
DAN CUTHBERT
(847)228-6620
N
N
01
001
20090824
0615882
PRIOVOLOS, TASOS & SOFIA
18214 S SPRING MEADOWS DR
N
N

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

XML parsing through shell scritps

Hi, Am new to scripting. :) Am trying to figure out whether can i use bash scripting to parse an xml file. Parsing is not just pulling out information according to the pattern but its more of a generic parsing. I should identify the xml hierarchy and pull out information accordingly. It's not a... (2 Replies)
Discussion started by: karthikvela
2 Replies

2. Shell Programming and Scripting

Parsing XML using Shell Script

Hello, I'm a starting shell scripter and no Perl knowledge. I've trying to do this for a while: I want to parse an XML file and get certain data out of it and write that data into a CSV file, all this using Shell Scripting (in Bash). Or Perl without any XML Parser/Interpreter (if possible). ... (1 Reply)
Discussion started by: Kage Musha
1 Replies

3. Shell Programming and Scripting

XML parsing in a shell script.

Below is a XML I have... <?xml version="1.0" encoding="UTF-8" ?> <component xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:XXXXX-www-Install-Manifest manifest.xsd" xmlns="urn:qqqqq-Install-Manifest" name="OM" ... (1 Reply)
Discussion started by: dashok.83
1 Replies

4. Shell Programming and Scripting

Shell script for XML code parsing.

Please help me to create a shell script that can parse the below XML and send a string back adding all XML values.:) <RequestBillsRsp... (1 Reply)
Discussion started by: xtatic
1 Replies

5. Shell Programming and Scripting

XML parsing using shell script

I have a xml file like this <bul:collectionStrategy name="strategy1"> <bul:collectionTemplateGroup name="15min group"/> <bul:collectionTemplateGroup name="hourly group"/> </bul:collectionStrategy> <bul:CollectionTemplateGroup name="hourly group" > ... (2 Replies)
Discussion started by: LavanyaP
2 Replies

6. Shell Programming and Scripting

XML to Text file Parsing Using shell scripting

Hi folks, Need some help with XML to text file parsing , the following is the content of the XML File. <xn:SubNetwork id="SNJNPRZDCR0R03"> <xn:MeContext id="PRSJU0005"> <xn:VsDataContainer id="PRSJU0005"> <xn:attributes> ... (6 Replies)
Discussion started by: tech_frk
6 Replies

7. Shell Programming and Scripting

Parsing XML using shell script

Well, issue is i have to parse this script to get the VERSION: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>CFBundleAllowMixedLocalizations</key> ... (9 Replies)
Discussion started by: zorosinister
9 Replies

8. Solaris

XML to Text file Parsing Using shell scripting

Hi, I want to parse an XML File using Shell Script preferably by using awk command, I/P file is : <gn:ExternalGsmCell id="016P3A"> <gn:attributes> <gn:mnc>410</gn:mnc> <gn:mcc>310</gn:mcc> <gn:lac>8016</gn:lac> ... (2 Replies)
Discussion started by: tech_frk
2 Replies

9. Shell Programming and Scripting

XML-Text Parsing Using shell scripting

HI Guys, I have to parse below xml file :- <xn:SubNetwork id="ONRM_ROOT_MO_R"> <xn:MeContext id="LP101"> <xn:ManagedElement id="1"> <xn:VsDataContainer id="1"> <xn:attributes> ... (8 Replies)
Discussion started by: asavaliya
8 Replies

10. Shell Programming and Scripting

Parsing custom data into xml in Shell

Hi , I have data as below in a text file { 'AAA' => { 'A1' => 'a1 comment', 'A2' => 'a2 comment' }, 'BBB' => { 'B1' => 'b1 comment' }, 'CCC' => { 'C1' => 'c1 comment', 'C2' => 'c2 comment', 'C3' => 'c3 comment' 'C4' => 'c4... (2 Replies)
Discussion started by: vivek d r
2 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 05:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy