rendered paste body<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:strip-space elements="*" /> <xsl:template match="/RESPONSE"> <ROWSET> <ROW num="1"> <xsl:apply-templates/> </ROW> </ROWSET> </xsl:template> <xsl:template match="effectiveDate"> <xsl:choose> <xsl:when test="normalize-space(.) = ''"> <EFFECTIVE_DT NULL="true"/> </xsl:when> <xsl:otherwise> <EFFECTIVE_DT><xsl:value-of select="."/></EFFECTIVE_DT> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="locationId"> <xsl:choose> <xsl:when test="normalize-space(.) = ''"> <ID NULL="true"/> </xsl:when> <xsl:otherwise> <ID><xsl:value-of select="text()"/></ID> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="regularHours"> <xsl:for-each select="closed"> <xsl:call-template name="generateDay"> <xsl:with-param name="index" select="position()"/> <xsl:with-param name="isClosed" select="text()"/> <xsl:with-param name="prefix">REG</xsl:with-param> <xsl:with-param name="openTime" select="../open[position()]"/> <xsl:with-param name="closeTime" select="../close[position()]"/> </xsl:call-template> </xsl:for-each> </xsl:template> <xsl:template match="urgentCareHours"> <xsl:for-each select="closed"> <xsl:call-template name="generateDay"> <xsl:with-param name="index" select="position()"/> <xsl:with-param name="isClosed" select="text()"/> <xsl:with-param name="prefix">URG</xsl:with-param> <xsl:with-param name="openTime" select="../open[position()]"/> <xsl:with-param name="closeTime" select="../close[position()]"/> </xsl:call-template> </xsl:for-each> </xsl:template> <xsl:template match="regHoursComment"> <xsl:choose> <xsl:when test="normalize-space(.) = '' "> <REG_LOC_HRS_NOTE NULL="true"/> </xsl:when> <xsl:otherwise> <REG_LOC_HRS_NOTE><xsl:value-of select="." /></REG_LOC_HRS_NOTE> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="urgHoursComment"> <xsl:choose> <xsl:when test="normalize-space(.) = '' "> <URG_LOC_HRS_NOTE NULL="true"/> </xsl:when> <xsl:otherwise> <URG_LOC_HRS_NOTE><xsl:value-of select="." /></URG_LOC_HRS_NOTE> </xsl:otherwise> </xsl:choose> </xsl:template> <!-- the following functions are utility functions --> <xsl:template name="generateDay"> <xsl:param name="isClosed" /> <xsl:param name="prefix" /> <xsl:param name="index" /> <xsl:param name="openTime"/> <xsl:param name="closeTime"/> <xsl:variable name="dayName"> <xsl:choose> <xsl:when test="$index = 1">MON</xsl:when> <xsl:when test="$index = 2">TUE</xsl:when> <xsl:when test="$index = 3">WED</xsl:when> <xsl:when test="$index = 4">THU</xsl:when> <xsl:when test="$index = 5">FRI</xsl:when> <xsl:when test="$index = 6">SAT</xsl:when> <xsl:when test="$index = 7">SUN</xsl:when> </xsl:choose> </xsl:variable> <xsl:variable name="openTimeElementName" select="concat($prefix, '_', $dayName, '_BEG_TM')" /> <xsl:variable name="closeTimeElementName" select="concat($prefix, '_', $dayName, '_END_TM')" /> <!-- generate open element --> <xsl:element name="{$openTimeElementName}"> <xsl:choose> <xsl:when test="$isClosed = 'true'"> <xsl:attribute name="NULL">true</xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:value-of select="../open[$index]" /> </xsl:otherwise> </xsl:choose> </xsl:element> <!-- generate close element --> <xsl:element name="{$closeTimeElementName}"> <xsl:choose> <xsl:when test="$isClosed = 'true'"> <xsl:attribute name="NULL">true</xsl:attribute> </xsl:when> <xsl:otherwise> <xsl:value-of select="../close[$index]" /> </xsl:otherwise> </xsl:choose> </xsl:element> </xsl:template> <xsl:template match="*" priority="-1" /> <!-- Throw away anything not matched --></xsl:stylesheet>