This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: XSL output method="text" and indent preservation


> have one issue. In
> your suggestion you had given it to get the substring after 
> the FIRST occurrence
> of the new line character, of preceding element. I would like 
> to get the
> substring after the LAST occurrence of the new line 
> character.  It would give me
> the white spaces only, in my case. It would be a great help, 

<xsl:template name="after-last-linefeed">
  <xsl:param name="text" select="preceding::text()[1]" />
  <xsl:choose>
    <xsl:when test="contains($text, '&#xA;')">
      <xsl:call-template name="after-last-linefeed">
        <xsl:with-param name="text" select="substring-after($text, '&#xA;')"
/>
      </xsl:call-template>
    </xsl:when>
    <xsl:otherwise>
      <xsl:value-of select="$text" />
    </xsl:otherwise>
  </xsl:choose>
</xsl:template>

Or write an extension function for

substring-after(exf:reverse(preceding::text()[1]), '&#xA;')

Jarno

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]