XSLT Scenario Works in Debug Only
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 14
- Joined: Mon Feb 09, 2009 5:49 pm
XSLT Scenario Works in Debug Only
I'm having problems getting an XSLT transform to work, but only in "normal" mode. If I debug the scenario it works perfectly. In non-debug I get the "Content is not allowed in prolog" error.
I've followed all the advice I could find on the error, including from this board, including triple-checking my encoding, setting BOM handling to "don't write" and changing my encoding across all related files, all to no avail. I've created and re-created scenarios, also to no avail.
Again, it works perfectly in debug.
Is there some place I should look for differences in how debug vs non-debug is run? Any settings I should tweak? Thanks for any help you can offer.
This is a fresh installation, <oXygen/> XML Editor 10.0, build 2008102212
Settings of my scenario:
XSLT tab
XML URL: ${currentFileURL}
XSL URL: file:/Q:/client/table1tocsv.xsl
Transformer: Saxon-B 9.1.0.3
FO Processor Tab
Perform FO Processing: checked
Input: XSLT result as input
Method: txt
Processor: Built-in (Apache FOP)
Output tab
Save as: checked, table1.txt
XSL content:
XML content:
I've followed all the advice I could find on the error, including from this board, including triple-checking my encoding, setting BOM handling to "don't write" and changing my encoding across all related files, all to no avail. I've created and re-created scenarios, also to no avail.
Again, it works perfectly in debug.
Is there some place I should look for differences in how debug vs non-debug is run? Any settings I should tweak? Thanks for any help you can offer.
This is a fresh installation, <oXygen/> XML Editor 10.0, build 2008102212
Settings of my scenario:
XSLT tab
XML URL: ${currentFileURL}
XSL URL: file:/Q:/client/table1tocsv.xsl
Transformer: Saxon-B 9.1.0.3
FO Processor Tab
Perform FO Processing: checked
Input: XSLT result as input
Method: txt
Processor: Built-in (Apache FOP)
Output tab
Save as: checked, table1.txt
XSL content:
Code: Select all
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output method="text"/>
<xsl:template match="NewDataSet">
<xsl:apply-templates select="NewTable11"/>
</xsl:template>
<xsl:template match="NewTable1">
<xsl:for-each select="*">
<xsl:text>"</xsl:text>
<xsl:value-of select="."/>
<xsl:text>"</xsl:text>
<xsl:if test="position() != last()">
<xsl:value-of select="','"/>
</xsl:if>
</xsl:for-each>
<xsl:text> </xsl:text>
</xsl:template>
</xsl:stylesheet>
Code: Select all
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE NewDataSet SYSTEM "Letter_XML.dtd">
<NewDataSet>
<NewTable1>
<Locator_Number>1</Locator_Number>
<Taxpayer_Number>4</Taxpayer_Number>
<Name>xxxxxxxxxxxxx </Name>
<Address1>P.O. BOX xxxxx </Address1>
<City>xxxxxx </City>
<State>TX</State>
<ZipCode>xxxxx-xxxx </ZipCode>
<Collecting_Client>28</Collecting_Client>
<Client_Name>Test xxxxxx</Client_Name>
<Mail_Address_Name>Mail address name</Mail_Address_Name>
<Client_Address1>Addr line 1</Client_Address1>
<Client_Address2>Addr line 2</Client_Address2>
<Client_City>City</Client_City>
<Client_State>xx</Client_State>
<Client_ZipCode>11111</Client_ZipCode>
<Client_Primary_Phone>(xxx) xxx-xxxx Ext. xxxxx</Client_Primary_Phone>
<County>xxxxxx</County>
<OfficialPaymentsCode>1234</OfficialPaymentsCode>
<Due_Date>2009-01-09T00:00:00-06:00</Due_Date>
<Total_Due>326.40</Total_Due>
<Month1_Total_Due>328.80</Month1_Total_Due>
<Month1_PandI>128.8000</Month1_PandI>
</NewTable1>
<NewTable1>
-
- Site Admin
- Posts: 2097
- Joined: Thu Jan 09, 2003 2:58 pm
Re: XSLT Scenario Works in Debug Only
The XML and stylsheet you posted are both incorrect. The XML is not wellformed and the stylesheet contains the NewTable1 misspelled. Well correcting both and adding an additional entry in the XML gives something like below:
Then, configuring a transformation scenario, without FOP processing (for that you need to output XSL-FO from your XSLT trnasformation) gives as result the following - note that the 2 lines that I got may be wrapped by the browser:
Best Regards,
George
Code: Select all
<?xml version="1.0" encoding="ISO-8859-1"?>
<NewDataSet>
<NewTable1>
<Locator_Number>1</Locator_Number>
<Taxpayer_Number>4</Taxpayer_Number>
<Name>xxxxxxxxxxxxx </Name>
<Address1>P.O. BOX xxxxx </Address1>
<City>xxxxxx </City>
<State>TX</State>
<ZipCode>xxxxx-xxxx </ZipCode>
<Collecting_Client>28</Collecting_Client>
<Client_Name>Test xxxxxx</Client_Name>
<Mail_Address_Name>Mail address name</Mail_Address_Name>
<Client_Address1>Addr line 1</Client_Address1>
<Client_Address2>Addr line 2</Client_Address2>
<Client_City>City</Client_City>
<Client_State>xx</Client_State>
<Client_ZipCode>11111</Client_ZipCode>
<Client_Primary_Phone>(xxx) xxx-xxxx Ext. xxxxx</Client_Primary_Phone>
<County>xxxxxx</County>
<OfficialPaymentsCode>1234</OfficialPaymentsCode>
<Due_Date>2009-01-09T00:00:00-06:00</Due_Date>
<Total_Due>326.40</Total_Due>
<Month1_Total_Due>328.80</Month1_Total_Due>
<Month1_PandI>128.8000</Month1_PandI>
</NewTable1>
<NewTable1>
<Locator_Number>2</Locator_Number>
<Taxpayer_Number>4</Taxpayer_Number>
<Name>xxxxxxxxxxxxx </Name>
<Address1>P.O. BOX xxxxx </Address1>
<City>xxxxxx </City>
<State>TX</State>
<ZipCode>xxxxx-xxxx </ZipCode>
<Collecting_Client>28</Collecting_Client>
<Client_Name>Test xxxxxx</Client_Name>
<Mail_Address_Name>Mail address name</Mail_Address_Name>
<Client_Address1>Addr line 1</Client_Address1>
<Client_Address2>Addr line 2</Client_Address2>
<Client_City>City</Client_City>
<Client_State>xx</Client_State>
<Client_ZipCode>11111</Client_ZipCode>
<Client_Primary_Phone>(xxx) xxx-xxxx Ext. xxxxx</Client_Primary_Phone>
<County>xxxxxx</County>
<OfficialPaymentsCode>1234</OfficialPaymentsCode>
<Due_Date>2009-01-09T00:00:00-06:00</Due_Date>
<Total_Due>326.40</Total_Due>
<Month1_Total_Due>328.80</Month1_Total_Due>
<Month1_PandI>128.8000</Month1_PandI>
</NewTable1>
</NewDataSet>
Code: Select all
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output method="text"/>
<xsl:template match="NewDataSet">
<xsl:apply-templates select="NewTable1"/>
</xsl:template>
<xsl:template match="NewTable1">
<xsl:for-each select="*">
<xsl:text>"</xsl:text>
<xsl:value-of select="."/>
<xsl:text>"</xsl:text>
<xsl:if test="position() != last()">
<xsl:value-of select="','"/>
</xsl:if>
</xsl:for-each>
<xsl:text> </xsl:text>
</xsl:template>
</xsl:stylesheet>
Code: Select all
"1","4","xxxxxxxxxxxxx ","P.O. BOX xxxxx ","xxxxxx ","TX","xxxxx-xxxx ","28","Test xxxxxx","Mail address name","Addr line 1","Addr line 2","City","xx","11111","(xxx) xxx-xxxx Ext. xxxxx","xxxxxx","1234","2009-01-09T00:00:00-06:00","326.40","328.80","128.8000"
"2","4","xxxxxxxxxxxxx ","P.O. BOX xxxxx ","xxxxxx ","TX","xxxxx-xxxx ","28","Test xxxxxx","Mail address name","Addr line 1","Addr line 2","City","xx","11111","(xxx) xxx-xxxx Ext. xxxxx","xxxxxx","1234","2009-01-09T00:00:00-06:00","326.40","328.80","128.8000"
George
George Cristian Bina
-
- Posts: 14
- Joined: Mon Feb 09, 2009 5:49 pm
Re: XSLT Scenario Works in Debug Only
Thank you George for your quick and very helpful reply. The errors in the files were my bad and unrelated to the problem. I had decided to edit them while I posted them and didn't do a very good job of it. The xml is much longer and I left off the ending tag when I trimmed it. The stylesheet error was just my edit error (I had mispelled table as tabel and was trying to quickly correct it in the name of pride and I also needed it to point to table1 and not 11 since that's the part of the xml I trimmed down to, arggh). I'll make sure I test what I'm posting if I plan to change it for post-purposes next time. Sorry about that.
Turning off FOP processing is what did the trick. I didn't really understand what it's purpose was, assuming it was required to perform the transform. I'm still very new to this and apologize for being such a noob.
Is there a current "best" book or online resource for really getting my hands around XSLT?
Also, and maybe I should post this separetely...I'm trying to figure out how to also output the column headings for the results of this XSLT which converts the XML to CSV. I've figured out the CSV part for the data from other posts, but haven't been able to get the tag names to show up as headings.
Thanks much!
Turning off FOP processing is what did the trick. I didn't really understand what it's purpose was, assuming it was required to perform the transform. I'm still very new to this and apologize for being such a noob.
Is there a current "best" book or online resource for really getting my hands around XSLT?
Also, and maybe I should post this separetely...I'm trying to figure out how to also output the column headings for the results of this XSLT which converts the XML to CSV. I've figured out the CSV part for the data from other posts, but haven't been able to get the tag names to show up as headings.
Thanks much!
-
- Site Admin
- Posts: 2097
- Joined: Thu Jan 09, 2003 2:58 pm
Re: XSLT Scenario Works in Debug Only
To get the headers you can use something like below
For XSLT books see the books section of our website
http://www.oxygenxml.com/xml_books.html
Best Regards,
George
Code: Select all
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output method="text"/>
<xsl:template match="NewDataSet">
<xsl:apply-templates select="NewTable1"/>
</xsl:template>
<xsl:template match="NewTable1[1]">
<xsl:for-each select="*">
<xsl:text>"</xsl:text>
<xsl:value-of select="name()"/>
<xsl:text>"</xsl:text>
<xsl:if test="position() != last()">
<xsl:value-of select="','"/>
</xsl:if>
</xsl:for-each>
<xsl:text> </xsl:text>
<xsl:next-match/>
</xsl:template>
<xsl:template match="NewTable1">
<xsl:for-each select="*">
<xsl:text>"</xsl:text>
<xsl:value-of select="."/>
<xsl:text>"</xsl:text>
<xsl:if test="position() != last()">
<xsl:value-of select="','"/>
</xsl:if>
</xsl:for-each>
<xsl:text> </xsl:text>
</xsl:template>
</xsl:stylesheet>
http://www.oxygenxml.com/xml_books.html
Best Regards,
George
George Cristian Bina
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service