Show dispenseGrid.xsl syntax highlighted
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:hl7="urn:hl7-org:v3">
<xsl:param name="DataSet"/>
<xsl:template match="text()|@*"></xsl:template>
<xsl:template match="/">
<Items>
<xsl:if test="$DataSet/Items">
<xsl:copy-of select="$DataSet/Items/*"/>
</xsl:if>
<xsl:apply-templates/>
</Items>
</xsl:template>
<xsl:template match="hl7:combinedMedicationRequest">
<xsl:variable name="total-quantity" select="hl7:component3[1]/hl7:supplyRequest[1]/hl7:component[1]/hl7:supplyRequestItem[1]/hl7:quantity[1]/@value"/>
<xsl:variable name="refills" select="hl7:component3[1]/hl7:supplyRequest[1]/hl7:component[1]/hl7:supplyRequestItem[1]/hl7:component2[1]/hl7:subsequentSupplyRequest[1]/hl7:repeatNumber[1]/@value"/>
<xsl:variable name="quantity" select="hl7:component3[1]/hl7:supplyRequest[1]/hl7:component[1]/hl7:supplyRequestItem[1]/hl7:component2[1]/hl7:subsequentSupplyRequest[1]/hl7:quantity[1]/@value"/>
<xsl:variable name="quantity-unit" select="hl7:component3[1]/hl7:supplyRequest[1]/hl7:component[1]/hl7:supplyRequestItem[1]/hl7:component2[1]/hl7:subsequentSupplyRequest[1]/hl7:quantity[1]/@unit"/>
<prescription>
<xsl:attribute name="Date"><xsl:value-of select="hl7:author[1]/hl7:time"/></xsl:attribute>
<xsl:attribute name="Status"><xsl:value-of select="hl7:statusCode/@code"/></xsl:attribute>
<xsl:attribute name="Drug"><xsl:value-of select="hl7:directTarget[1]/hl7:medication[1]/hl7:player[1]/hl7:name[1]"/></xsl:attribute>
<xsl:attribute name="Quantity"><xsl:value-of select="$quantity"/><xsl:value-of select="$quantity-unit"/></xsl:attribute>
<xsl:attribute name="Refills"><xsl:value-of select="$refills"/></xsl:attribute>
<xsl:attribute name="Dosage_Per_Day"><xsl:value-of select="hl7:component1[1]/hl7:dosageInstruction[1]/hl7:maxDoseQuantity[1]/hl7:numerator[1]/@value"/></xsl:attribute>
<xsl:attribute name="Dosage_Instruction"><xsl:value-of select="hl7:component1[1]/hl7:dosageInstruction[1]/hl7:text[1]"/></xsl:attribute>
<xsl:attribute name="Prescriber"><xsl:value-of select="hl7:author[1]/hl7:assignedPerson[1]/hl7:representedPerson[1]/hl7:name[1]/hl7:given[1]"/><xsl:text> </xsl:text><xsl:value-of select="hl7:author[1]/hl7:assignedPerson[1]/hl7:representedPerson[1]/hl7:name[1]/hl7:family[1]"/></xsl:attribute>
<xsl:attribute name="Dispensed">
<xsl:choose>
<xsl:when test="hl7:fulfillment[1]/hl7:medicationDispense[1]"><xsl:text>true (</xsl:text><xsl:value-of select="count(hl7:fulfillment/hl7:medicationDispense)"/><xsl:text>)</xsl:text></xsl:when>
<xsl:otherwise>false</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</prescription>
</xsl:template>
</xsl:stylesheet>
See more files for this project here