saxon:indent-spaces attribute is being ignored

2019-08-01 08:25发布

In my question here I'm trying to pass in a param to my stylesheet so a user can specify the level of indentation desired. Apparently Xalan cannot read the value of a param into its indent-amount attribute, so I'm trying with this version of Saxon-HE instead.

Saxon has the attribute indent-spaces which I am trying to use as follows:

<xsl:stylesheet
    version="2.0"
    xmlns:saxon="http://saxon.sf.net"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <!-- <xsl:param name="indent-spaces" select="0"/> -->

    <xsl:output indent="yes" method="xml" omit-xml-declaration="yes" saxon:indent-spaces="10"/><!-- Doesn't matter what I make the value of indent-spaces, the output is always indented 3 spaces -->

Why is indent-spaces being ignored?

标签: xslt saxon
2条回答
倾城 Initia
2楼-- · 2019-08-01 08:44

The namespace should be xmlns:saxon="http://saxon.sf.net/" instead of xmlns:saxon="http://saxon.sf.net".

查看更多
等我变得足够好
3楼-- · 2019-08-01 08:59

First, all Saxon extensions require Saxon-PE or higher.

Second, if you want to control serialization parameters dynamically (e.g. from a stylesheet parameter, you can do this using xsl:result-document:

<xsl:result-document indent="yes" saxon:indent-spaces="{$param}">
  ...
</xsl:result-document>
查看更多
登录 后发表回答