Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Help - I'm losing newline when performing XSL Transform

From: "jjouett" <jjouett@-----.--->
To: NULL
Date: 10/1/2005 2:40:00 PM
I'm trying to preserve the newline characters in my transformed XML
(read from a file) to provide a meaningful line number when validation
errors occur. However, my current method which performs an XSL
transform prior to validation is removing all the newlines. The XSL is
simply adding a namespace:


   <xsl:stylesheet
     xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform"
     version=3D"1.0"
     xmlns=3D"urn:RegisteredUser-schema">

      <!-- This will just set the namespace of the topmost object -->
      <xsl:template match=3D"*">
        <xsl:element name=3D"{local-name()}">
          <xsl:apply-templates select=3D"@* | node()" />
        </xsl:element>
      </xsl:template>

      <xsl:template match=3D"@*">
        <xsl:copy-of select=3D"." />
      </xsl:template>

   </xsl:stylesheet>

The problem is that an input XML string which has newlines goes from:


   <user>
     <firstname>Joe</firstname>
     <lastname>User</lastname>
   </user>


to a string without newlines:


   <user
xmlns=3D"urn:RegisteredUserschema"><firstname>Joe</firstname><lastname>User=
</=ADlastname></user>



So any subsequent validation failure states that an error occurred on
line 1.  I would like to be able to preserve the newlines in the
original string representation of the file, so that the error message
displayed to the user is meaningful.=20


Thanks in advance



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent