I will try, but this is not verified:
<xsl:variable name="var1_ClinicalDocument" select="ns0:ClinicalDocument"/> <DSMessage> <DSPatient> <xsl:for-each select="$var1_ClinicalDocument[ns0:id/@root]"> <Source> <xsl:value-of select="ns0:id/@root"/> </Source> </xsl:for-each> <Demographics> <xsl:for-each select="($var1_ClinicalDocument/ns0:recordTarget/ns0:patientRole/ns0:id)[@extension]"> <externalID> <xsl:value-of select="@extension"/> </externalID> </xsl:for-each> <xsl:for-each select="($var1_ClinicalDocument/ns0:recordTarget/ns0:patientRole/ns0:patient/ns0:name/ns0:given/node())[self::text()]"> <firstName> <xsl:value-of select="."/> </firstName>
Basically the use of fn:exists , fn:string and fn:boolean can be replaced, of course, if you are using XPath / XSLT 2.0 tokenize like tokenize or for-each-group , you need more work and maybe Xalan specific extension functions .
source share