Thanks Jont! It is working fine. The only thing that remains is that I don't want a comma after the last attribute...how to do that?e.g.
x,200,item,
w,500,788,
w,444,ppp,
should be
x,200,item
w,500,788
w,444,ppp
i.e. no comma if it is the last attribute.
Thanks in advance
Great Jonty
I am trying your solution...
here is the one that I wrote..
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<!-- xml_files to be used as input -->
<xsl:variable name="source" select="//input/@source"...
Thanks Tom
Let me clarify it.
The file called first.xml contains the data. The file called second.xml contains the ordering information. I need to write an xslt that outputs the comma separated values of attributes of each element of first.xml in the order specified by second.xml.
for example...
hi there
I have two xml files and would like to generate a text file. The logic is
first.xml
<?xml version="1.0"?>
<source>
<object partid ="4" name = "def" price = "3000"/>
<object partid ="5" name = "jkl" price = "130"/>
<object partid ="1" name = "abc1" price = "0"/>
<object partid ="2" name...
hi jonty
It worked out...thanks. Actually I changed the input file format a little bit as
<?xml version="1.0"?>
<input>
<file1 finename="first.xml" paramname="partid"</file1>
<file2 finename="second.xml" paramname="ID"</file1>
</input>
and changed
<xsl:variable name="file1"...
hi Jonty...thanks again for sorting this out..below are all my input files and xslts. [this is going to be a long post]
------------------first.xml----------------------
<?xml version="1.0"?>
<root1>
<object partid ="4" name = "def" price = "3000"/>
<object partid ="5" name = "jkl" price =...
hi jonty
<xsl:variable name ="attribute1"
select = "document($file2)//@*[name(.)=$param2]"/>
<xsl:copy-of
select=
"document($file1)//*[@*[name(.)=$param1]=$attribute1]"/>
I am doing the above as you said....but it throws unkown XPath Error???
hi jonty
thank you very much for your reply. Can you see this in little bit more detail that what I am trying to do is:
<xsl:variable name ="attribute1"
select = "document($file2)//@ID"/>
<xsl:copy-of
select="document($file1)//*[@partid=$attribute1]"/>
It is a simple two step...
sorry probably I could not explain the problem...
see, I am using
@partid and thus it selects partid attributes...
but I want it to be generic such that...
@xyz and xyz is some variable which I can set
thus if xyz is partid then it would become @partid
and if xyz is ID then it would...
hi I am doing the following
<xsl:variable name ="att" select = "//@partid" />
i.e. selecting all attributes having 'partid' name. what I want to do is that this partid is variable. i.e. something that can change. i.e.
<xsl:variable name ="att" select = "//@XXXX" />
where XXXX is a...
Hi there
I want to find the intersection of two xml files using XSLT. Plz see the following example as help.
<?xml version="1.0"?>
<root>
<object ID ="1" name = "abc" price = "0"/>
<object ID ="2" name = "def" price = "430"/>
<object ID ="3" name = "abc" price = "350"/>
<object ID ="4" name =...
Hi jonty thanx for your reply. Let me show you what I want.
File1.xml
<?xml version="1.0"?>
<root>
<object ID ="1" name = "abc" price = "0"/>
<object ID ="2" name = "def" price = "430"/>
<object ID ="3" name = "abc" price = "350"/>
<object ID ="4" name = "def" price = "3000"/>
<object ID ="5"...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.