Menu

xml:space preserve and not preserve ?

saxon-help
Horst
2006-11-27
2012-10-08
  • Horst

    Horst - 2006-11-27

    Hello,

    i'm using a stylesheet to create a adobe xfdf file. the spec from adobe claims that the xml:space attribute is required and the value must be preserve. so i tried to use

    <xsl:template match="/root">
    <xfdf-head>
    <xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space='preserve'>
    ...

    The result of the transformation was that the content of this xfdf node preserved the whitespaces. i wonder why saxon reacts to this attribute, because it is inside of the result document.

    Using this syntax:
    <xsl:template match="/root">
    <xfdf-head>
    <xfdf xmlns="http://ns.adobe.com/xfdf/">
    <xsl:attribute name="xml:space">preserve</xsl:attribute>
    ...

    the content whitespaces are NOT preserved.
    I don't understand what's the difference between the two alternatives. shouldn't they generate the same result ?

    thanx for light

     
    • Michael Kay

      Michael Kay - 2006-11-30

      First, sorry for not responding earlier. I don't get notified of messages on this forum. The forum seems to have recently reappeared with changes to the Sourceforge GUI, and I hadn't noticed it.

      Second, general XSLT coding questions are best asked on the xsl-list at mulberrytech.com.

      The presence of xml:space='preserve' in the result file affects the serializer: when indenting is in use, the indenter must not add or remove whitespace in a section of the document controlled by this attribute.

      Michael Kay