xml:space preserve and not preserve ?

  • Horst

    Horst - 2006-11-27


    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 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 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


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks