saxon:indent-spaces attribute is being ignored

时间秒杀一切 提交于 2019-12-11 08:59:27

问题


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?


回答1:


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




回答2:


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>


来源:https://stackoverflow.com/questions/18769752/saxonindent-spaces-attribute-is-being-ignored

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!