12-30-2008
Wow. That approach works great. Thanks Chris.
Also, can you help me understand - how could i have changed the original approach to take care of this - 'cos i have a feeling that i was nearly there (or maybe not!!)
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
I have a file which i have to remove some line from it,
the lines that i have to remove from my file is as below:
</new_name></w"s" langue="Fr-fr" version="1.0" encoding="UTF-8" ?> <New_name>
and it is finding at the middle of my file,
is there any command line in linux to do it or do... (10 Replies)
Discussion started by: id_2pc
10 Replies
2. Shell Programming and Scripting
Hi All,
Find the following code:
<Universal>D38x82j1JJ
</Universal>
I want to retrieve the value of <Universal> tag as below:
Please help me. (3 Replies)
Discussion started by: mjavalkar
3 Replies
3. Shell Programming and Scripting
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
4. Shell Programming and Scripting
Hi All,
I need a help on inserting a XML tag.
Actual input
<var>
<nam>abcd</nam>
<a1>.</a1>
</var>
if tag <a1>.</a1> is getting missed in XML like below
<var>
<nam>abcd</nam>
</var>
i need to insert wherever it is missed after <nam> tag and before </var> tag.
Could anyone... (3 Replies)
Discussion started by: mohanalakshmi
3 Replies
5. Shell Programming and Scripting
I have this XML file -
<gp>
<mms>1110012</mms>
<tg>988</tg>
<mm>LongTime</mm>
<lv>
<lkid>StartEle=ONE, Desti = Motion</lkid>
<kk>12</kk>
</lv>
<lv>
<lkid>StartEle=ONE, Source = Velocity</lkid>
<kk>2</kk>
</lv>
<lv>
... (3 Replies)
Discussion started by: NeedASolution
3 Replies
6. Shell Programming and Scripting
Hi all,
I basically want to remove certain characters from within a certain XML tag:
From:
<mytagone>hello 1-2-3 world</mytagone>
<mytagtwo>hello 1-2-3 world</mytagtwo>
To:
<mytagone>hello 1 2 3 world</mytagone>
<mytagtwo>hello 1-2-3 world</mytagtwo>
Is this possible using sed... (6 Replies)
Discussion started by: Jedimark
6 Replies
7. Shell Programming and Scripting
Hi Guys
Here is my Input :
<?xml version="1.0" encoding="UTF-8"?>
<xn:MeContext id="01736">
<xn:VsDataContainer id="01736">
<xn:attributes>
<xn:vsDataType>vsDataMeContext</xn:vsDataType>
... (12 Replies)
Discussion started by: pareshkp
12 Replies
8. Shell Programming and Scripting
I want to basically do the below thing. Suppose there is a tag called object1. I want to display an output for all similar tag values under heading of Object 1 and the count of the xmls. Please help
File:
<xml><object1>house</object1><object2>child</object2>... (9 Replies)
Discussion started by: srkmish
9 Replies
9. Shell Programming and Scripting
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
10. Shell Programming and Scripting
Hi Forum.
I have an XML file with the following requirement to move the <AdditionalAccountHolders> tag and its content right after the <accountHolderName> tag within the same file but I'm not sure how to accomplish this through a Unix script.
Any feedback will be greatly appreciated.
... (19 Replies)
Discussion started by: pchang
19 Replies
LEARN ABOUT LINUX
xmerl_xs
xmerl_xs(3erl) Erlang Module Definition xmerl_xs(3erl)
NAME
xmerl_xs -
Erlang has similarities to XSLT since both languages
have a functional programming approach.
DESCRIPTION
Erlang has similarities to XSLT since both languages have a functional programming approach. Using xmerl_xpath it is possible to write XSLT
like transforms in Erlang.
XSLT stylesheets are often used when transforming XML documents, to other XML documents or (X)HTML for presentation. XSLT contains quite
many functions and learning them all may take some effort. This document assumes a basic level of understanding of XSLT.
Since XSLT is based on a functional programming approach with pattern matching and recursion it is possible to write similar style sheets
in Erlang. At least for basic transforms. This document describes how to use the XPath implementation together with Erlangs pattern match-
ing and a couple of functions to write XSLT like transforms.
This approach is probably easier for an Erlanger but if you need to use real XSLT stylesheets in order to "comply to the standard" there is
an adapter available to the Sablotron XSLT package which is written i C++. See also the Tutorial .
EXPORTS
built_in_rules(Fun, E) -> List
The default fallback behaviour. Template funs should end with:
template(E) -> built_in_rules(fun template/1, E) .
select(String::string(), E) -> E
Extracts the nodes from the xml tree according to XPath.
See also: value_of/1 .
value_of(E) -> List
Types E = unknown()
Concatenates all text nodes within the tree.
Example:
<xsl:template match="title">
<div align="center">
<h1><xsl:value-of select="." /></h1>
</div>
</xsl:template>
becomes:
template(E = #xmlElement{name='title'}) ->
["<div align="center"><h1>",
value_of(select(".", E)), "</h1></div>"]
xslapply(Fun::Function, EList::list()) -> List
Types Function = () -> list()
xslapply is a wrapper to make things look similar to xsl:apply-templates.
Example, original XSLT:
<xsl:template match="doc/title">
<h1>
<xsl:apply-templates/>
</h1>
</xsl:template>
becomes in Erlang:
template(E = #xmlElement{ parents=[{'doc',_}|_], name='title'}) ->
["<h1>",
xslapply(fun template/1, E),
"</h1>"];
AUTHORS
<>
xmerl 1.2.8 xmerl_xs(3erl)