Click here to Skip to main content
15,888,908 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

I am trying to generate HL7 Msg with the help of XSLT. Values are getting filled in it by Objects from Code page.

I am able to generate the String but Pipe are not appearing in the entire msg.

Following is the XSLT and code I am using.

XSLT :


XML
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output indent="yes" method="text"/>
<xsl:param name="SendingApplication">SendingApplication</xsl:param>
<xsl:param name="SendingFacility">SendingFacility</xsl:param>
<xsl:param name="ReceivingApplication">ReceivingApplication</xsl:param>
<xsl:param name="ReceivingFacility">ReceivingFacility</xsl:param>
<xsl:template match="/">
<hl7>
<MSH fieldDelimiter="|" componentDelimiter="^" repeatDelimiter="~" escapeDelimiter="\" subcomponentDelimiter="&amp;">
<field>MSH</field>
<field><xsl:value-of select="$SendingApplication"/></field>
<field><xsl:value-of select="$SendingFacility"/></field>
<field><xsl:value-of select="$ReceivingApplication"/></field>
<field><xsl:value-of select="$ReceivingFacility"/></field>
<field/> <!-- Date/time of Message -->
<field/> <!-- Security -->
<field>ORM<component>O01</component></field>
<field/> <!-- Message Control ID -->
<field>P</field>
<field>2.3</field>
<field/> <!-- Sequence Number -->
<field/> <!-- Continuation Pointer -->
<field/> <!-- Accept Acknowledgment Type -->
<field/> <!-- Application Acknowledgment Type -->
<field/> <!-- Country Code -->
</MSH>
</hl7>
</xsl:template>
</xsl:stylesheet>



.cs :

C#
private void button1_Click(object sender, EventArgs e)
     private void button1_Click(object sender, EventArgs e)
{
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load("mapping.xslt");
XsltArgumentList args = new XsltArgumentList();
args.AddParam("SendingApplication", "", "Value");
string hl7MsgString = string.Empty;
XmlDocument xmlDoc = new XmlDocument();
StringWriter writer = new System.IO.StringWriter();
xslt.Transform(xmlDoc, args, writer);
hl7MsgString = writer.ToString();
writer.Close();

}




And following is the resulting string :

"MSHRISSendingFacilityReceivingApplicationReceivingFacilityORMO01P2.3"

Please help in Getting Pipe in between the HL7 string.
Posted
Updated 25-Nov-10 22:32pm
v3
Comments
Dalek Dave 26-Nov-10 4:32am    
Edited for Code Block.

Please try to use this:

<MSH fielddelimiter="&#124;" componentdelimiter="^" repeatdelimiter="~" escapedelimiter="\" subcomponentdelimiter="&amp;">


Cheers

Manfred
 
Share this answer
 
v3
Comments
Dalek Dave 26-Nov-10 4:32am    
Good Call.
Thanks Manfred,

But it dint work.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900