Unwanted text in XSL output

Here should go questions about transforming XML with XSLT and FOP.
stuchalk
Posts: 4
Joined: Fri Feb 19, 2010 2:29 pm

Unwanted text in XSL output

Post by stuchalk »

It seems that when I start feeling confident in my XSL coding abilities I stumble on a "simple" problem like this. I am trying to generate an SVG file from an XML source file and everything looks great except I get extra text at the top of the output file...

<?xml version="1.0" encoding="UTF-8"?> Tartrazin, 1.1944mg/100mlNaNKExported PE IR WinLab Data File<!DOCTYPE svg
PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010 ... /svg10.dtd">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 600">

The source and xsl files are in the folder linked below. Can anyone advise me what I am doing wrong? (using Saxon-HE 9.2.0.3 in oXygen 11.1)

http://chalk.coas.unf.edu/ftp/

Stuart Chalk
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Unwanted text in XSL output

Post by adrian »

Hi,
The ftp needs authentication...
http://chalk.coas.unf.edu/ftp/ wrote:403 Forbidden
You don't have permission to access /ftp/ on this server.
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
stuchalk
Posts: 4
Joined: Fri Feb 19, 2010 2:29 pm

Re: Unwanted text in XSL output

Post by stuchalk »

Oops, sorry. I have fixed the permissions. It should be available now...

Stuart
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Unwanted text in XSL output

Post by adrian »

Hello,

What you are experiencing is the cause of one of the built-in template rules:
http://www.w3.org/TR/xslt20/#built-in-rule

The built in rule that's bothering you is:

Code: Select all

<xsl:template match="text()|@*" mode="#all">
<xsl:value-of select="string(.)"/>
</xsl:template>
To override it you need to add to your stylesheet:

Code: Select all

<xsl:template match="text()"/>
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
stuchalk
Posts: 4
Joined: Fri Feb 19, 2010 2:29 pm

Re: Unwanted text in XSL output

Post by stuchalk »

Thank you, XSL guru!

Stuart
Post Reply