"Hermann Peifer" <peifer@gmx.netwrote in message
news:48DE7596.6070203@gmx.net...
Quote:
For your inspiration: here an example stylesheet which is properly
transforming XML documents into tab-separated text files:
http://tinyurl.com/3zf2bo
>
Hope this helps, Hermann
Thanks Herman! I have now tried to construct a new XSLT based on your
example (see the full text at the end). I think I have got it almost right,
but when I try to run it in Xalan against my XML files I get the following
exception:
file:///data/disk21/tab-output.xslt; Line #71; Column #79; XSLT Error
(javax.xml.transform.TransformerConfigurationExcep tion):
javax.xml.transform.TransformerException: org.xml.sax.SAXParseException:
Open quote is expected for attribute "select" associated with an element
type "xsl:value-of".
Exception in thread "main" java.lang.RuntimeException:
javax.xml.transform.TransformerException: org.xml.sax.SAXParseException:
Open quote is expected for attribute "select" associated with an element
type "xsl:value-of".
at org.apache.xalan.xslt.Process.doExit(Process.java: 1153)
at org.apache.xalan.xslt.Process.main(Process.java:11 26)
As far as I can see it does not like my qoutes, but they are exactly like
yours. I run Xalan on a Linux server. The XSLT file is saved in Unix file
format and ANSI encoding using TextPad, and then copied as binary to the
server.
Any ideas how to fix this?
Thanks again - John
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<!-- Stylesheet inspired by one by Hermann Peifer, EEA, March 2008 -->
<!-- Variable definition for tab delimited output -->
<xsl:variable name="newline" select="'
'"/>
<xsl:variable name="tab" select="'	'"/>
<xsl:output method="text" encoding="UTF-8"/>
<xsl:template match="/">
<!-- Write out field names -->
<xsl:text>accn</xsl:text <xsl:value-of select="$tab"/>
<xsl:text>abgn</xsl:text <xsl:value-of select="$tab"/>
<xsl:text>newrt</xsl:text <xsl:value-of select="$tab"/>
<xsl:text>rtname</xsl:text <xsl:value-of select="$tab"/>
<xsl:text>jt</xsl:text <xsl:value-of select="$tab"/>
<xsl:text>ajt</xsl:text <xsl:value-of select="$tab"/>
<xsl:text>vol</xsl:text <xsl:value-of select="$tab"/>
<xsl:text>ino</xsl:text <xsl:value-of select="$tab"/>
<xsl:text>voliss</xsl:text <xsl:value-of select="$tab"/>
<xsl:text>yr</xsl:text <xsl:value-of select="$newline"/>
<xsl:apply-templates select="inspec/article"/>
</xsl:template>
<!-- Loop through each field -->
<xsl:template match="article">
<xsl:value-of select="inspec/article/contg/accn"/ <xsl:value-of
select="$tab"/>
<xsl:value-of select="inspec/article/contg/abng"/ <xsl:value-of
select="$tab"/>
<xsl:value-of select="inspec/article/contg/rtypg/newrt"/ <xsl:value-of
select="$tab"/>
<xsl:value-of select="inspec/article/contg/rtypg/rtng/rtname"/>
<xsl:value-of select="$tab"/>
<xsl:value-of select="inspec/article/bibliog/jrefg/jrog/jt"/>
<xsl:value-of select="$tab"/>
<xsl:value-of select="inspec/article/bibliog/jrefg/jrog/ajt"/>
<xsl:value-of select="$tab"/>
<xsl:value-of select="inspec/article/bibliog/jrefg/jrog/vid/vol"/>
<xsl:value-of select="$tab"/>
<xsl:value-of select="inspec/article/bibliog/jrefg/jrog/vid/ino"/>
<xsl:value-of select="$tab"/>
<xsl:value-of select="inspec/article/bibliog/jrefg/jrog/vid/voliss"/>
<xsl:value-of select="$tab"/>
<xsl:value-of select="inspec/article/contg/crt/yr"/ <xsl:value-of
select=$newline"/>
</xsl:template>
</xsl:stylesheet>