The best way of handling this type of problem is using XSLT and a stylesheet.
Here is a stylesheet (file.xsl) which will do what you want:
Assuming for the purpose of this example that you want to change "abcd" to "Finnbarr" and that you have xsltproc installed on your system, here is how you would do the transformation together with the resulting output:
Note the double and single quotes around the vale of the NAME parameter. These are required.
Hi,
i call my shell like:
my_shell "my project name"
my script:
#!/bin/bash -vx
projectname=$1
sed s/'PROJECT_NAME ='/'PROJECT_NAME = '$projectname/ <test_config_doxy >temp
cp temp test_config_doxy
the following error occurres:
sed s/'PROJECT_NAME ... (2 Replies)
Search and Replace a string pattern with empty in an xml file in unix:
My xml file would be like this :
<Accounts><Name>Harish</Name><mobile>90844444444444445999 </mobile><TRIG>srcujim-1</TRIG></Accounts><Accounts><Name>Satish</Name><mobile>908999</mobile><TRIG>ettertrtt-1</TRIG></Accounts>
... (1 Reply)
Hello Unix gurus!
I'm a unix newbie. Can I use sed to replace a keyword in an xml file and convert this keyword with an output of a unix cat command?
for example: <test>keyword</test>
and temp.txt = hello!
I would like to replace "keyword" with the output of "cat temp.txt".
I think... (6 Replies)
Can someone tell me how I can do this?
e.g:
a=$(echo -e wert trewt ertert ertert ertert erttert
erterte
rterter
tertertert
ert)
How do i replace the STRING with $a?
I try this:
sed -i 's/STRING/'"$a"'/g' filename.ext
but this don' t work (2 Replies)
here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb
cat dump.sql
INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Hi All
i need to replace the url1 inside <remote> tag in below xml in first instance and in the second instance with url2.
any help appreciated
<locations>
<hudson.scm.SubversionSCM_-ModuleLocation>
<remote>https://svn2015.com/svn/repos/internalshard</remote>
... (4 Replies)
Hello,
I have below xml file, I want to find line default-value and replace the string within quotes followed by default-value "moni/Websphere/". Replace moni/Websphere/ with monitor/AMQ/
<monitor>
<name>WebsphereMqMonitor</name>
<type>managed</type>
<argument... (4 Replies)
Sorry for the long/weird title but I'm stuck on a problem I have. I have this XML file:
</member>
<member>
<name>TransactionID</name>
<value><string>123456789123456</string></value>
</member>
<member>
<name>Number</name>
... (9 Replies)
Hi All,
I'm new to sed.
In following XML file
<interface type='direct'>
<mac address='52:54:00:86:ce:f6'/>
<source dev='eno1' mode='bridge'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
... (8 Replies)
Discussion started by: varunrapelly
8 Replies
LEARN ABOUT DEBIAN
template::xml
Template::XML(3pm) User Contributed Perl Documentation Template::XML(3pm)NAME
Template::XML - XML plugins for the Template Toolkit
SYNOPSIS
[% USE XML;
dom = XML.dom('foo.xml');
xpath = XML.xpath('bar.xml');
simple = XML.simple('baz.xml');
rss = XML.simple('news.rdf');
%]
DESCRIPTION
The Template-XML distribution provides a number of Template Toolkit plugin modules for working with XML.
The Template::Plugin::XML module is a front-end to the various other XML plugin modules. Through this you can access XML files and direc-
tories of XML files via the Template::Plugin::XML::File and Template::Plugin::XML::Directory modules (which subclass from the Tem-
plate::Plugin::File and Template::Plugin::Directory modules respectively). You can then create a Document Object Model (DOM) from an XML
file (Template::Plugin::XML::DOM), examine it using XPath queries (Template::Plugin::XML::XPath), turn it into a Perl data structure (Tem-
plate::Plugin::XML::Simple) or parse it as an RSS (RDF Site Summary) file.
The basic XML plugins were distributed as part of the Template Toolkit until version 2.15 released in May 2006. At this time they were
extracted into this separate Template-XML distribution and an alpha version of this Template::Plugin::XML front-end module was added.
AUTHORS
Andy Wardley wrote the Template Toolkit plugin modules, with assistance from Simon Matthews in the case of the XML::DOM plugin. Matt
Sergeant wrote the XML::XPath module. Enno Derksen and Clark Cooper wrote the XML::DOM module. Jonathan Eisenzopf wrote the XML::RSS mod-
ule. Grant McLean wrote the XML::Simple module. Clark Cooper and Larry Wall wrote the XML::Parser module. James Clark wrote the expat
library.
COPYRIGHT
Copyright (C) 1996-2006 Andy Wardley. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
Template, Template::Plugins, Template::Plugin::XML, Template::Plugin::XML::DOM, Template::Plugin::XML::RSS, Template::Plugin::XML::Simple,
Template::Plugin::XML::XPath
perl v5.8.8 2008-03-01 Template::XML(3pm)