getting the output in the form of xml

S

sp

hai

i have got
1. an xml file
2. an xsl file

and my xsl file filters the xml based on attribute value

and the output i receive is in the ordinary format

could any help in getting the output in the form of xml

i tried

<xsl:eek:utput method="xml" />

this is not working

i worked on VC++ to know the output string but i am receiving only the
tag values as output i need the entire xml matching the filter
condition.

plz help me to get the output in the correct format

thanks
praveen
 
M

Martin Honnen

sp wrote:

i have got
1. an xml file
2. an xsl file

and my xsl file filters the xml based on attribute value

and the output i receive is in the ordinary format

What exactly is "the ordinary format", plain text, or HTML, or what else?

could any help in getting the output in the form of xml

i tried

<xsl:eek:utput method="xml" />

this is not working

Well what exactly does your stylesheet look like, how does your input
XML look?
Make sure that your XSLT stylesheet creates result elements with e.g.
<xsl:copy>
or with
<xsl:element>
or with literal result elements, it does not suffic to use e.g.
<xsl:value-of select="." />
to create elements.
 
S

sp

the xml file i used


<catalog>
<cd>
<title year="1990">Empire Burlesque</title>
<artist>Bob Dylan</artist>
<price>10.90</price>
</cd>
<cd>
<title year="1995">Hide your heart</title>
<artist>Bonnie Tyler</artist>
<price>9.90</price>
</cd>
<cd>
<title year="1995">Greatest Hits</title>
<artist>Dolly Parton</artist>
<price>9.90</price>
</cd>
<cd>
<title year="1995">Still got the blues</title>
<artist>Gary Moore</artist>
<price>10.20</price>
</cd>
<cd>
<title year="1998">Eros</title>
<artist>Eros Ramazzotti</artist>
<price>9.90</price>
</cd>
<cd>
<title year="1998">One night only</title>
<artist>Bee Gees</artist>
<price>10.90</price>
</cd>
</catalog>


the output expected


<cd>
<title year="1990">Empire Burlesque</title>
<artist>Bob Dylan</artist>
<price>10.90</price>
</cd>


the xsl used


<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:eek:utput method="xml" />
<xsl:template match="/">
<xsl:for-each select="/catalog/cd[title[@year='1990']]">
<xsl:value-of select="." />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

my output is

Empire Burlesque Bob Dylan 10.90


is there anything i have to change in the xsl to get the output in the
xml format
 
S

sp

the xml file i used


<catalog>
<cd>
<title year="1990">Empire Burlesque</title>
<artist>Bob Dylan</artist>
<price>10.90</price>
</cd>
<cd>
<title year="1995">Hide your heart</title>
<artist>Bonnie Tyler</artist>
<price>9.90</price>
</cd>
<cd>
<title year="1995">Greatest Hits</title>
<artist>Dolly Parton</artist>
<price>9.90</price>
</cd>
<cd>
<title year="1995">Still got the blues</title>
<artist>Gary Moore</artist>
<price>10.20</price>
</cd>
<cd>
<title year="1998">Eros</title>
<artist>Eros Ramazzotti</artist>
<price>9.90</price>
</cd>
<cd>
<title year="1998">One night only</title>
<artist>Bee Gees</artist>
<price>10.90</price>
</cd>
</catalog>


the output expected


<cd>
<title year="1990">Empire Burlesque</title>
<artist>Bob Dylan</artist>
<price>10.90</price>
</cd>


the xsl used


<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:eek:utput method="xml" />
<xsl:template match="/">
<xsl:for-each select="/catalog/cd[title[@year='1990']]">
<xsl:value-of select="." />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

my output is

Empire Burlesque Bob Dylan 10.90


is there anything i have to change in the xsl to get the output in the
xml format
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,001
Messages
2,570,254
Members
46,851
Latest member
CliftonCor

Latest Threads

Top