XSLT which output non-xml text in XProc

Questions about XML that are not covered by the other forums should go here.
serioadamo97
Posts: 22
Joined: Tue Oct 17, 2017 5:05 pm

XSLT which output non-xml text in XProc

Post by serioadamo97 » Tue Feb 27, 2018 8:11 pm

I have a XSLT to generate code
text.xsl:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:output method="text" encoding="UTF-8"/>
<xsl:template name="main">
// Code generated xxxxx
// .......
class Test
{
}
</xsl:template>
</xsl:stylesheet>
And a XProc
test.xpl

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">
<p:output port="result" primary="false">
<p:pipe port="result" step="test"/>
</p:output>

<p:xslt name="test" template-name="main">
<p:input port="source">
<p:empty/>
</p:input>
<p:input port="stylesheet">
<p:document href="test.xsl"/>
</p:input>
<p:input port="parameters">
<p:empty/>
</p:input>
</p:xslt>
</p:declare-step>
When execute test.xpl, the error occured:
Engine name: Calabash XProc
Severity: error
Description: p:xslt returned non-XML result
Start location: 8:46

I read the document in w3c https://www.w3.org/TR/xproc/#c.xslt
It does not say that the output of p:xslt must be xml.

Is there any way to fix this issue ?

Thanks.

Radu
Posts: 6590
Joined: Fri Jul 09, 2004 5:18 pm

Re: XSLT which output non-xml text in XProc

Post by Radu » Wed Feb 28, 2018 12:32 pm

Hi,

I don't think there is a way to overcome this without wrapping your output text in an XML tag, you should read this part of the XProc specs:

https://www.w3.org/TR/xproc/#binary

I think that right now they are working on the XProc 3.0 standard which may have the support you want but I'm not sure.
There is an XProc users list if you want to ask around:

http://xproc.org/

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply