Mac Rost]
[[
Tom,
I have tried this solution but was unable to make it work... here is the
whole xml file that's being used.
]]
That is because I made an slightly incorrect assumption about the form of
your escaped characters. Here is a tiny modification that does work with
your full xml example. It also puts out html (which the previous stylesheet
did not). Note that (if I understand what you want to do), that you do not
need to use disable-output-escaping, as someone suggested.
==========================================================
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/HotelInfo">
<html>
<xsl:apply-templates/>
</html>
</xsl:template>
<xsl:template match='areaInformation'>
<div>
<!-- Call the recursive string splitter -->
<xsl:call-template name='break-at-string'>
<xsl:with-param name='data' select='.'/>
<xsl:with-param name='separator' select='"<br>"'/>
</xsl:call-template>
</div>
</xsl:template>
<xsl:template name='break-at-string'>
<xsl:param name='data'/>
<xsl:param name='separator'/>
<xsl:variable name='first'
select='substring-before($data,$separator)'/>
<xsl:variable name='rest' select='substring-after($data,$separator)'/>
<xsl:choose>
<!-- When there is a separator in the string, display
the first part followed by a <br/>, then call ourself to process
the rest -->
<xsl:when test='$rest'>
<xsl:value-of select='$first'/><br/>
<xsl:call-template name='break-at-string'>
<xsl:with-param name='data' select='$rest'/>
<xsl:with-param name='separator' select='$separator'/>
</xsl:call-template>
</xsl:when>
<!-- If there are no more separators, we are done -->
<xsl:otherwise>
<xsl:value-of select='$data'/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Suppress output from the default template-->
<xsl:template match='*'/>
</xsl:stylesheet>
===================================================
[[
<HotelInfo>
<hotelID>122352</hotelID>
<propertyType>H</propertyType>
<rating>3.0</rating>
<!-- other elements deleted to save space - tpb -->
<areaInformation>Area Attractions: -Cherry Creek State Park 1 Block
<br> -Aurora Mall 2 Miles <br> -Movie Theaters 4 Miles
<br> -Fidlers Green 10 Miles <br> -Park Meadows Mall 15
Miles <br> -Downtown Denver 20 Miles</areaInformation>
</HotelInfo>
]]
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list