transforming to text file

Are you missing a feature? Request its implementation here.
agashirazi
Posts: 4
Joined: Wed Nov 05, 2003 7:46 pm

transforming to text file

Post by agashirazi »

Hey,

Can someone please tell me, what functions do I use to transform an XML to a text file? I created an XSL shylesheet file, but it throws an error saying that the for-each statement is not placed right. But when I use the same structure with the HTML tags, it works fine.

Here is my code:

********************************************

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:for-each select="NSF_QUERY/QUERYITEM">
<xsl:value-of select="TITLE"/>
<xsl:value-of select="ABSTRACT/ABSTRACT_UNPARSED"/>
</xsl:for-each>
</xsl:stylesheet>


********************************************


Thanks a lot guys for my previous responses, really appreciat it.

Aga Shirazi
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Aga,

You should place your code inside a template. Try something like:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:for-each select="NSF_QUERY/QUERYITEM">
<xsl:value-of select="TITLE"/>
<xsl:value-of select="ABSTRACT/ABSTRACT_UNPARSED"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
You may consider also looking over an XSL tutorial like the one below:
http://www.zvon.org/xxl/XSLTutorial/

Best Regards,
George
Post Reply