p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition ISBN: 978-0-470-19274-0 (http://p2p.wrox.com/forumdisplay.php?f=398)
-   -   chap 19 : parse-gedcom.xsl (http://p2p.wrox.com/showthread.php?t=68474)

jacquesfauquex May 29th, 2008 01:57 PM

chap 19 : parse-gedcom.xsl
With oXygen XML Editor 9.2 on Mac, I tried from the xslt debugger with Saxon 9B to have parse-gedcom.xsl work with input kennedy.ged.

Before running the debugger, I had configured a parameter input = '/Users/jacquesfauquex/Downloads/ch19/kennedy.ged'

After running the debugger, the result window shows

Location: 1:0
Description: Content is not allowed in prolog.
E Content is not allowed in prolog. - 1:0
F Content is not allowed in prolog. - 1:0

... it looks like that xslt doesn't like to parse a text document instead of a xml document. Though, to parse text document is what the example wants to demostrate...

What do I do wrong?


mhkay May 29th, 2008 02:35 PM

I guess you probably configured oxygen to treat kennedy.ged as the primary source document of the transformation. This won't work - the primary input must be XML if it exists at all. This stylesheet runs without any primary source document; it reads kennedy.ged as a secondary input file using the unparsed-text() function.

Michael Kay
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

jacquesfauquex May 29th, 2008 03:36 PM

How then could I run parse-gedcom.xsl from saxon.jar comand line. More exactly, what are the options to add to
java -jar saxon9.jar -xsl:parse-gedcom.xsl

I tried
 java -jar saxon9.jar -xsl:parse-gedcom.xsl +param=/kennedy.ged

Although I copied kennedy.ged at the root of my HD, the terminal answers :

"Source file +param=/kennedy.ged does not exist"

Thanks a lot for your answers,

Jacques Fauquex

samjudson May 29th, 2008 03:51 PM

You have two options here, either supply a 'dummy' source document (can be any valid XML file) or use the -it switch. Note the parameter name at the end should be 'input'.

Also note that +param=file (note the '+') loads the parameters from the given file.

java -jar saxon9.jar -it main parse-gedcom.xsl input=kennedy.ged

java -jar saxon9.jar -s dummy.xml parse-gedcom.xsl input=kennedy.ged

/- Sam Judson : Wrox Technical Editor -/

mhkay May 29th, 2008 04:08 PM

java -jar saxon9.jar -it:main -xsl:parse-gedcom.xsl input=kennedy.ged

-it:main causes transformation to start at the template named "main".

input=kennedy.ged sets the value of <xsl:param name="input"/>.

The parameter is a string, not an XML document, so you don't want the "+" sign.

Michael Kay
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference

All times are GMT -4. The time now is 04:35 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.