[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] new user question Saxon


Subject: [xsl] new user question Saxon
From: g l <glarowe@xxxxxxxxxxx>
Date: Wed, 21 Sep 2005 11:35:23 -0500

I'm using Saxon 8.4 from Saxonica to process some xml files containing Physical Review data for transformation into tab-delimited files I can then upload into a database. To handle some of the data in the xml, I'm using <xsl:result-document> to write out a new file for a given node.

Problem is that sometimes the processor just kicks back processed data to the screen instead of writing it out to the file(s). No errors or warnings are issued, it simply spits back the data from the XML file (tags removed). I've read that this is because the XML file in question is not valid, nor do I think it's a problem with <xsl:result-document>, but I'm not sure. I think it has something to do with xmlns namespaces, but I'm at a loss ... Thanks for any help in advance

Processor:	Saxon from Saxonica
Version: 		8.4

Command Used
----------------------
java -jar saxon8.jar -dt example.xml stylesheet.xsl

First 20 lines of example.xml
---------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//The Beacon Group//DTD Article ATI Math 1.01//EN" "article.dtd">
<article xmlns:m="http://www.w3.org/1998/Math/MathML">
<meta>
<journal coden="PLRAAN" issn="1050-2947" jcode="PRA" short="Phys. Rev. A">Physical Review A</journal>
<volume>69</volume>
<issue printdate="2004-03-00">3</issue>
<eid>030501</eid>
<numpages>4</numpages>
<price>$22.50</price>
<tocsec code="A/R3D">Atomic and molecular structure and dynamics</tocsec>
<arttype type="rapid"/>
<doi>10.1103/PhysRevA.69.030501</doi>
<runningtitle>IN SEARCH OF THE ELECTRON DIPOLE MOMENT?</runningtitle>
<title>In search of the electron dipole moment: <emph type="italic">Ab initio</emph> calculations on <formula chemical="yes">
<m:math xmlns:m="http://www.w3.org/1998/Math/MathML" display="inline"><m:mrow><m:mmultiscripts><m:mi mathvariant="normal">PbO</m:mi><m:mprescripts xmlns:m="http://www.w3.org/1998/Math/MathML"/><m:none xmlns:m="http://www.w3.org/1998/Math/MathML"/><m:mrow><m:mn>207</m: mn></m:mrow>


Header and <xsl:result-document> example in stylesheet.xsl
------------------------------------------------------------------------ ----------
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:saxon="http://saxon.sf.net/"
xmlns:m="http://www.w3.org/1998/Math/MathML"
version="2.0">


<xsl:output method="text" omit-xml-declaration="no" indent="no" escape-uri-attributes="yes"/>

...
...

<!-- result-document example -->

<xsl:template name="body">
	 <xsl:param name="artid"/>  	<!-- unique identifier -->
	<xsl:choose>
	<xsl:when test="BODY">
		<xsl:result-document href="body/body_{$artid}.sql">
			<xsl:value-of select="$artid"/>
			<xsl:value-of select="$tab"/>
			<xsl:value-of select="normalize-space(BODY)"/>
			<xsl:value-of select="$newline"/>
			</xsl:result-document>
	</xsl:when>
	<xsl:otherwise>
			<xsl:result-document href="bad/body_{$artid}.sql">
			</xsl:result-document>
	</xsl:otherwise>
	</xsl:choose>
</xsl:template>


Current Thread
Keywords
xml