Quantcast

saxon:line-length not work for method="xml"

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

saxon:line-length not work for method="xml"

Eliot Kimber-2
Using Saxon 9.6.0.7 this style sheet, applied to itself:

<?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"
  xmlns:saxon="http://saxon.sf.net/"
  exclude-result-prefixes="xs saxon"
  version="2.0">
  <xsl:output method="xml" saxon:line-length="40" />
  <xsl:template match="/">
    <result>
      <xsl:value-of select="'this is a very long line that is much longer
than 40 characters
        this is a very long line that is much longer than 40 characters
        this is a very long line that is much longer than 40 characters'"/>
    </result>
  </xsl:template>
</xsl:stylesheet>



Does not break the result lines at 40 characters. If I change the method
to "html" then it does.

The docs indicate that saxon:line-length should work for XML and HTML
output methods.

Cheers,

Eliot
----
Eliot Kimber, Owner
Contrext, LLC
http://contrext.com




------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: saxon:line-length not work for method="xml"

John Lumley-2
On 08/02/2016 15:23, Eliot Kimber wrote:
Using Saxon 9.6.0.7 this style sheet, applied to itself:

<?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"
  xmlns:saxon="http://saxon.sf.net/"
  exclude-result-prefixes="xs saxon"
  version="2.0">
  <xsl:output method="xml" saxon:line-length="40" />
  <xsl:template match="/">
    <result>
      <xsl:value-of select="'this is a very long line that is much longer
than 40 characters 
        this is a very long line that is much longer than 40 characters
        this is a very long line that is much longer than 40 characters'"/>
    </result>
  </xsl:template>
</xsl:stylesheet>



Does not break the result lines at 40 characters. If I change the method
to "html" then it does.

The docs indicate that saxon:line-length should work for XML and HTML
output methods.
The documentation, at http://www.saxonica.com/html/documentation/extensions/output-extras/serialization-parameters.html actually says:

saxon:line-length?

integer

Default value 80. With the XML output method, attributes are output on a new line if they would otherwise extend beyond this column position. With the HTML output method, text lines are split at this line length when possible. In releases 9.2 and earlier, the HTML output method attempted to split lines that exceeded 120 characters in length.


which implies that for XML the line-breaking only occurs before attribute="value" (atomic) declarations, not text nodes themselves, as output whitespace might be significant. In HTML, where extended whitespace is less significant, text nodes can be broken. The code implements that behaviour

John

--
John Lumley MA PhD CEng FIEE
[hidden email]
on behalf of Saxonica Ltd

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: saxon:line-length not work for method="xml"

Eliot Kimber-2
Doh! Right you are—I did not read closely enough and took the discussion of XML and HTML in the context of the same attribute as meaning it applied to both in the same way.

Sorry for the misreport.

Cheers,

E.
----
Eliot Kimber, Owner
Contrext, LLC
http://contrext.com

From: John Lumley <[hidden email]>
Reply-To: Mailing list for the SAXON XSLT and XQuery processor <[hidden email]>
Date: Monday, February 8, 2016 at 10:35 AM
To: Mailing list for the SAXON XSLT and XQuery processor <[hidden email]>
Subject: Re: [saxon] saxon:line-length not work for method="xml"

On 08/02/2016 15:23, Eliot Kimber wrote:
Using Saxon 9.6.0.7 this style sheet, applied to itself:

<?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"
  xmlns:saxon="http://saxon.sf.net/"
  exclude-result-prefixes="xs saxon"
  version="2.0">
  <xsl:output method="xml" saxon:line-length="40" />
  <xsl:template match="/">
    <result>
      <xsl:value-of select="'this is a very long line that is much longer
than 40 characters
        this is a very long line that is much longer than 40 characters
        this is a very long line that is much longer than 40 characters'"/>
    </result>
  </xsl:template>
</xsl:stylesheet>



Does not break the result lines at 40 characters. If I change the method
to "html" then it does.

The docs indicate that saxon:line-length should work for XML and HTML
output methods.
The documentation, at http://www.saxonica.com/html/documentation/extensions/output-extras/serialization-parameters.html actually says:

saxon:line-length?

integer

Default value 80. With the XML output method, attributes are output on a new line if they would otherwise extend beyond this column position. With the HTML output method, text lines are split at this line length when possible. In releases 9.2 and earlier, the HTML output method attempted to split lines that exceeded 120 characters in length.


which implies that for XML the line-breaking only occurs before attribute="value" (atomic) declarations, not text nodes themselves, as output whitespace might be significant. In HTML, where extended whitespace is less significant, text nodes can be broken. The code implements that behaviour

John

--
John Lumley MA PhD CEng FIEE
[hidden email]
on behalf of Saxonica Ltd
------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140_______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ [hidden email] https://lists.sourceforge.net/lists/listinfo/saxon-help

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Loading...