Announcement

Collapse
No announcement yet.

White space removed by XSLT

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • White space removed by XSLT

    I have several channels which perform XSL transforms on the message xml. These transforms often require white space to be inserted and output in the resultant xml - one example is in formatting the patient name from an ORM message. When the transforms are performed in a Java class, the white space is preserved, but not when uusing the XSLT step in a transformer.

    Below is a bit of one xsl:


    <xsl:template name='formatName'>
    <xsl: param name='firstName'/>
    <xsl: param name='lastName'/>
    <xsl: param name='initial'/>

    <xsl:value-of select='$lastName'/><xsl:text>, </xsl:text>
    <xsl:value-of select='$firstName'/>
    <xsl:if test='string-length($initial) &gt; 0'>
    <xsl:text> </xsl:text><xsl:value-of select='$initial'/>
    </xsl:if>
    </xsl:template>

    This results in: "Last,FirstI: instead of "Last, First I"

    I've also tried:

    <xsl:template name='formatName'>
    <xsl: param name='firstName'/>
    <xsl: param name='lastName'/>
    <xsl: param name='initial'/>

    <xsl:value-of select='$lastName'/><xsl:text>, </xsl:text>
    <xsl:value-of select='$firstName'/>
    <xsl:if test='string-length($initial) &gt; 0'>
    <xsl:text> </xsl:text><xsl:value-of select='$initial'/>
    </xsl:if>
    </xsl:template>

    I get same results.

    Because of transparency and maintainablity, I would rather not use a Java Class. I like the way the XSL is part of the step and would like to continue using the xslt step. I've also tried using <xslreserve-space elements="*"/> to no avail.

    Any suggestions would be gratefully received.
Working...
X