[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

replace multiple distinct strings

Subject: replace multiple distinct strings
From: "Derrick Koes" <derrick_koes@xxxxxxxxxxx>
Date: Mon, 29 Sep 2003 15:29:19 -0400
javascript replace multiple

I'm attempting to write a javascript escape function like template in xsl. I wish to escape text to it's URL escaped form (i.e. %xx where x is a hex digit).


I've tried two different style sheets that I think should accomplish the same thing. However, I end up with the following error: javax.xml.transform.TransformerException: java.lang.RuntimeException: Invalid conversion from ?reference? to ?java.lang.String?.

I am using xalan 2.4.1 (cannot use 2.5.1 because of carriage return bug 23147) xsltc to compile and cache my stylesheets.

Below is listed the stylesheet, the two templates, then followed by sample xml for processing and the "replacement" xml.

<?xml version="1.0" encoding="UTF-8"?>
<!-- File: patientInfo.xsl -->
<!-- Lanaguage: US English -->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:js="http://javascript.com">
<xsl:include href="escape.xsl"/>
<xsl:output method="html"/>


<xsl:variable name="lang.patient.MRN" select="'Medical Record'"/>

 <xsl:variable name="lang.patient.name.title" select="'Title'"/>
 <xsl:variable name="lang.patient.name.first" select="'First Name'"/>
 <xsl:variable name="lang.patient.name.mi" select="'MI'"/>
 <xsl:variable name="lang.patient.name.last" select="'Last Name'"/>

 <xsl:variable name="lang.patient.DOB" select="'Date of Birth'"/>
 <xsl:variable name="lang.patient.required" select="'Required Fields'"/>

 <xsl:variable name="lang.patient.address.street" select="'Street'"/>
 <xsl:variable name="lang.patient.address.city" select="'City'"/>
 <xsl:variable name="lang.patient.address.state" select="'State'"/>
 <xsl:variable name="lang.patient.address.zip" select="'Zip'"/>
 <xsl:variable name="lang.patient.address.country" select="'Country'"/>

<xsl:variable name="lang.patient.contact.phone" select="'Phone'"/>
<xsl:variable name="lang.patient.contact.email" select="'e-mail Address'"/>


 <xsl:variable name="lang.patient.data.SSN" select="'Social Security'"/>
 <xsl:variable name="lang.patient.data.sex" select="'Sex'"/>
 <xsl:variable name="lang.patient.data.sex.male" select="'Male'"/>
 <xsl:variable name="lang.patient.data.sex.female" select="'Female'"/>

 <xsl:variable name="lang.patient.month.jan" select="'January'"/>
 <xsl:variable name="lang.patient.month.feb" select="'February'"/>
 <xsl:variable name="lang.patient.month.mar" select="'March'"/>
 <xsl:variable name="lang.patient.month.apr" select="'April'"/>
 <xsl:variable name="lang.patient.month.may" select="'May'"/>
 <xsl:variable name="lang.patient.month.jun" select="'June'"/>
 <xsl:variable name="lang.patient.month.jul" select="'July'"/>
 <xsl:variable name="lang.patient.month.aug" select="'August'"/>
 <xsl:variable name="lang.patient.month.sep" select="'September'"/>
 <xsl:variable name="lang.patient.month.oct" select="'October'"/>
 <xsl:variable name="lang.patient.month.nov" select="'November'"/>
 <xsl:variable name="lang.patient.month.dec" select="'December'"/>

 <xsl:variable name="lang.patient.miss" select="'Miss'"/>
 <xsl:variable name="lang.patient.mr" select="'Mr'"/>
 <xsl:variable name="lang.patient.mrs" select="'Mrs'"/>
 <xsl:variable name="lang.patient.ms" select="'Ms'"/>

<xsl:variable name="lang.patient.opt.info" select="'Show Optional Information'"/>

 <xsl:variable name="lang.button.create" select="'Create'"/>
 <xsl:variable name="lang.button.save" select="'Update'"/>
 <xsl:variable name="lang.button.reset" select="'Restore Fields'"/>

 <xsl:variable name="lang.episodes" select="'Episodes of Care:'"/>
 <xsl:variable name="lang.button.proc" select="'New Procedure'"/>
 <xsl:variable name="lang.procedureList.type" select="'Procedure'"/>
 <xsl:variable name="lang.procedureList.date" select="'Date'"/>
 <xsl:variable name="lang.export" select="'Download'"/>

 <xsl:param name="title"/>
 <xsl:param name="month"/>
 <xsl:param name="day"/>
 <xsl:param name="year"/>
 <xsl:param name="action"/>
 <xsl:param name="download"/>
 <xsl:param name="case"/>

 <xsl:template match="List">
   <input type="hidden" name="patientId" value="{Patient/@patientId}"/>
   <input type="hidden" name="userId" value="{Patient/@userId}"/>

   <xsl:choose>
    <xsl:when test="$action='create'">
           <input type="hidden" name="action" value="create"/>
   </xsl:when>
   <xsl:otherwise>
        <input type="hidden" name="action" value="update"/>
   </xsl:otherwise>
   </xsl:choose>

<table align="center" class="searchBorder">
<tr>
<td>
<table align="center">
<tr>
<td class='boldSmallFont'><xsl:value-of select="$lang.patient.name.title"/></td>
<td>
<select NAME="Title" size="1">
<option VALUE=""><xsl:text> -- </xsl:text></option>
<option VALUE="Miss"><xsl:value-of select="$lang.patient.miss"/></option>
<option VALUE="Mr"><xsl:value-of select="$lang.patient.mr"/></option>
<option VALUE="Mrs"><xsl:value-of select="$lang.patient.mrs"/></option>
<option VALUE="Ms"><xsl:value-of select="$lang.patient.ms"/></option>
</select>
</td>
</tr>


<xsl:variable name="escapedFirstNameBackslash">
<xsl:call-template name="escapeBackslash">
<xsl:with-param name="text" select="Patient/Name/FirstName"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="escapedFirstName">
<xsl:call-template name="escapeApos">
<xsl:with-param name="text" select="$escapedFirstNameBackslash"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="escapedMIBackslash">
<xsl:call-template name="escapeBackslash">
<xsl:with-param name="text" select="Patient/Name/MI"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="escapedMI">
<xsl:call-template name="escapeApos">
<xsl:with-param name="text" select="$escapedMIBackslash"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="escapedLastNameBackslash">
<xsl:call-template name="escapeBackslash">
<xsl:with-param name="text" select="Patient/Name/LastName"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="escapedLastName">
<xsl:call-template name="escapeApos">
<xsl:with-param name="text" select="$escapedLastNameBackslash"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="escapedMRNBackslash">
<xsl:call-template name="escapeBackslash">
<xsl:with-param name="text" select="Patient/MRN"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="escapedMRN">
<xsl:call-template name="escapeApos">
<xsl:with-param name="text" select="$escapedMRNBackslash"/>
</xsl:call-template>
</xsl:variable>
<script>
var firstName = '<xsl:value-of select="$escapedFirstName"/>';
var mi = '<xsl:value-of select="$escapedMI"/>';
var lastName = '<xsl:value-of select="$escapedLastName"/>';
var mrn = '<xsl:value-of select="$escapedMRN"/>';
</script>
<tr>
<td class='boldSmallFont'><xsl:value-of select="$lang.patient.name.first"/> <xsl:text> * </xsl:text></td>
<td><input type="text" name="FirstName" maxlength="25" size="20"/></td>
</tr>
<tr>
<td class='boldSmallFont'><xsl:value-of select="$lang.patient.name.mi"/></td>
<td><input type="text" name="MI" maxlength="1" size="1" /></td>
</tr>
<tr>
<td class='boldSmallFont'><xsl:value-of select="$lang.patient.name.last"/> <xsl:text> * </xsl:text></td>
<td><input type="text" name="LastName" maxlength="30" size="20" /></td>
</tr>
<tr>
<td class='boldSmallFont'><xsl:value-of select="$lang.patient.MRN"/><xsl:text> * </xsl:text></td>
<td><input type="text" name="MRN" maxlength="15" size="15" /></td>
</tr>
<tr>
<td class="smallFont">
<xsl:text>*</xsl:text>
<xsl:value-of select="$lang.patient.required" />
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table align="center">
<tr><td align="center" colspan="4" ><HR></HR></td></tr>
<tr><td class='boldSmallFont'><xsl:value-of select="$lang.episodes"/></td></tr>
<tr>
<td class="boldSmallFont"><xsl:value-of select="$lang.procedureList.type"/></td>
<td class="boldSmallFont"><xsl:value-of select="$lang.procedureList.date"/></td>
</tr>


<xsl:variable name="createProcedure" select="concat('ProcedureCreate.jsp?patientId=', Patient/@patientId)"/>
<tr>
<TD class="smallFont"><a href="{$createProcedure}"><xsl:value-of select="$lang.button.proc"/></a></TD>
</tr>


<xsl:for-each select="List/Procedure">
<xsl:variable name="url" select="concat('ProcedureUpdate.jsp?patientId=', @patientId, '&amp;procedureId=', @procedureId)"/>
<xsl:variable name="caseUrl" select="concat($case, @procedureId)"/>
<xsl:variable name="escapedType">
<xsl:call-template name="js:escape">
<xsl:with-param name="text" select="Type"/>
<xsl:with-param name="replacements" select="document('replace.xml')/js:escapes/replace"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="downloadUrl" select="concat($download, '?url=', $caseUrl, '&amp;type=', $escapedType, '&amp;date=', Date)"/>
<xsl:variable name="escapedBackslashDownloadUrl">
<xsl:call-template name="escapeBackslash">
<xsl:with-param name="text" select="$downloadUrl"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="escapedAposDownloadUrl">
<xsl:call-template name="escapeApos">
<xsl:with-param name="text" select="$escapedBackslashDownloadUrl"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="escapedDownloadUrl">
<xsl:call-template name="escapeQuotToSingle">
<xsl:with-param name="text" select="$escapedAposDownloadUrl"/>
</xsl:call-template>
</xsl:variable>
<TR>
<TD class="smallFont"><a href="{$url}"><xsl:value-of select="Type"/></a></TD>
<TD class="smallFont"><xsl:value-of select="Date"/></TD>
<TD class="smallFont"><a href="javascript:void(0)" onclick="window.showModalDialog('{$escapedDownloadUrl}', window, 'dialogHeight:20;dialogWidth:45;center:yes; status:no; resizable:yes; scroll:yes; help:no; edge:raised; unadorned:yes; dialogTop:0')"><xsl:value-of select="$lang.export"/></a></TD>
</TR>
</xsl:for-each>
<tr><td align="center" colspan="4" ><HR></HR></td></tr>
</table>


<table align="center">
<tr>
<td align="center" class="boldSmallFont">
<a onmouseout="this.style.cursor='auto'"
onmouseover="this.style.cursor='hand'"
id="showHideLink" href="javascript:showHideAnchor('optionalData')">
<xsl:value-of select="$lang.patient.opt.info"/>
</a>
</td>
</tr>
</table>


<xsl:variable name="escapedStreetBackslash">
<xsl:call-template name="escapeBackslash">
<xsl:with-param name="text" select="Patient/ContactData/Address/Street"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="escapedStreet">
<xsl:call-template name="escapeApos">
<xsl:with-param name="text" select="$escapedStreetBackslash"/>
</xsl:call-template>
</xsl:variable>


<xsl:variable name="escapedCityBackslash">
<xsl:call-template name="escapeBackslash">
<xsl:with-param name="text" select="Patient/ContactData/Address/City"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="escapedCity">
<xsl:call-template name="escapeApos">
<xsl:with-param name="text" select="$escapedCityBackslash"/>
</xsl:call-template>
</xsl:variable>


<xsl:variable name="escapedStateBackslash">
<xsl:call-template name="escapeBackslash">
<xsl:with-param name="text" select="Patient/ContactData/Address/State"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="escapedState">
<xsl:call-template name="escapeApos">
<xsl:with-param name="text" select="$escapedStateBackslash"/>
</xsl:call-template>
</xsl:variable>


<xsl:variable name="escapedZipBackslash">
<xsl:call-template name="escapeBackslash">
<xsl:with-param name="text" select="Patient/ContactData/Address/Zip"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="escapedZip">
<xsl:call-template name="escapeApos">
<xsl:with-param name="text" select="$escapedZipBackslash"/>
</xsl:call-template>
</xsl:variable>


<xsl:variable name="escapedCountryBackslash">
<xsl:call-template name="escapeBackslash">
<xsl:with-param name="text" select="Patient/ContactData/Address/Country"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="escapedCountry">
<xsl:call-template name="escapeApos">
<xsl:with-param name="text" select="$escapedCountryBackslash"/>
</xsl:call-template>
</xsl:variable>
<script>
var street = '<xsl:value-of select="$escapedStreet"/>';
var city = '<xsl:value-of select="$escapedCity"/>';
var state = '<xsl:value-of select="$escapedState"/>';
var zip = '<xsl:value-of select="$escapedZip"/>';
var country = '<xsl:value-of select="$escapedCountry"/>';
</script>
<table align="center" id="optionalData" style="display:'none'">
<tr>
<td class='boldSmallFont'><xsl:value-of select="$lang.patient.address.street"/></td>
<td><input type="text" name="Street" size="15" maxlength="30"/></td>
</tr>
<tr>
<td class='boldSmallFont'><xsl:value-of select="$lang.patient.address.city"/></td>
<td><input type="text" name="City" size="15" maxlength="30"/></td>
</tr>
<tr>
<td class='boldSmallFont'><xsl:value-of select="$lang.patient.address.state"/></td>
<td><input type="text" name="State" size="5" maxlength="5"/></td>
</tr>
<tr>
<td class='boldSmallFont'><xsl:value-of select="$lang.patient.address.zip"/></td>
<td><input type="text" name="Zip" size="10" maxlength="10"/></td>
</tr>
<tr>
<td class='boldSmallFont'><xsl:value-of select="$lang.patient.address.country"/></td>
<td><input type="text" name="Country" size="10" maxlength="25" /></td>
</tr>
<tr><td colspan = "2" align="center"><HR></HR></td></tr>


<tr>
<td class='boldSmallFont'><xsl:value-of select="$lang.patient.DOB"/></td>
<td>
<select name="month" SIZE="1" >
<option VALUE="0"><xsl:text>--</xsl:text></option>
<option VALUE="1"><xsl:value-of select="$lang.patient.month.jan"/></option>
<option VALUE="2"><xsl:value-of select="$lang.patient.month.feb"/></option>
<option VALUE="3"><xsl:value-of select="$lang.patient.month.mar"/></option>
<option VALUE="4"><xsl:value-of select="$lang.patient.month.apr"/></option>
<option VALUE="5"><xsl:value-of select="$lang.patient.month.may"/></option>
<option VALUE="6"><xsl:value-of select="$lang.patient.month.jun"/></option>
<option VALUE="7"><xsl:value-of select="$lang.patient.month.jul"/></option>
<option VALUE="8"><xsl:value-of select="$lang.patient.month.aug"/></option>
<option VALUE="8"><xsl:value-of select="$lang.patient.month.sep"/></option>
<option VALUE="10"><xsl:value-of select="$lang.patient.month.oct"/></option>
<option VALUE="11"><xsl:value-of select="$lang.patient.month.nov"/></option>
<option VALUE="12"><xsl:value-of select="$lang.patient.month.dec"/></option>
</select>
<select name="day" SIZE="1" >
<option VALUE="0">--</option>
<option VALUE="1">1</option>
<option VALUE="2">2</option>
<option VALUE="3">3</option>
<option VALUE="4">4</option>
<option VALUE="5">5</option>
<option VALUE="6">6</option>
<option VALUE="7">7</option>
<option VALUE="8">8</option>
<option VALUE="9">9</option>
<option VALUE="10">10</option>
<option VALUE="11">11</option>
<option VALUE="12">12</option>
<option VALUE="13">13</option>
<option VALUE="14">14</option>
<option VALUE="15">15</option>
<option VALUE="16">16</option>
<option VALUE="17">17</option>
<option VALUE="18">18</option>
<option VALUE="19">19</option>
<option VALUE="20">20</option>
<option VALUE="21">21</option>
<option VALUE="22">22</option>
<option VALUE="23">23</option>
<option VALUE="24">24</option>
<option VALUE="25">25</option>
<option VALUE="26">26</option>
<option VALUE="27">27</option>
<option VALUE="28">28</option>
<option VALUE="29">29</option>
<option VALUE="30">30</option>
<option VALUE="31">31</option>
</select>
<input type="text" name="year" value="{$year}" size="4" maxlength="4" />
</td>
</tr>


<xsl:variable name="escapedPhoneBackslash">
<xsl:call-template name="escapeBackslash">
<xsl:with-param name="text" select="Patient/ContactData/Phone"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="escapedPhone">
<xsl:call-template name="escapeApos">
<xsl:with-param name="text" select="$escapedPhoneBackslash"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="escapedEmailBackslash">
<xsl:call-template name="escapeBackslash">
<xsl:with-param name="text" select="Patient/ContactData/Email"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="escapedEmail">
<xsl:call-template name="escapeApos">
<xsl:with-param name="text" select="$escapedEmailBackslash"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="escapedSSNBackslash">
<xsl:call-template name="escapeBackslash">
<xsl:with-param name="text" select="Patient/PatientData/SSN"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="escapedSSN">
<xsl:call-template name="escapeApos">
<xsl:with-param name="text" select="$escapedSSNBackslash"/>
</xsl:call-template>
</xsl:variable>


<script>
var phone = '<xsl:value-of select="$escapedPhone"/>';
var email = '<xsl:value-of select="$escapedEmail"/>';
var ssn = '<xsl:value-of select="$escapedSSN"/>';
</script>
<tr>
<td class='boldSmallFont'><xsl:value-of select="$lang.patient.contact.phone"/></td>
<td><input type="text" name="Phone" size="15" maxlength="15"/></td>
</tr>
<tr>
<td class='boldSmallFont'><xsl:value-of select="$lang.patient.contact.email"/></td>
<td><input type="text" name="Email" size="20" maxlength="50"/></td>
</tr>
<tr>
<td class='boldSmallFont'><xsl:value-of select="$lang.patient.data.SSN"/></td>
<td><input type="text" name="SSN" size="11" maxlength="11"/></td>
</tr>
<tr>
<td valign="middle" class='boldSmallFont'>
<xsl:value-of select="$lang.patient.data.sex"/>
</td>
<td class='boldSmallFont'>
<input type="radio" name="Sex" value="F" />
<xsl:value-of select="$lang.patient.data.sex.female"/>
<br/>
<input type="radio" name="Sex" value="M" />
<xsl:value-of select="$lang.patient.data.sex.male"/>
</td>
</tr>
</table>
</td>
</tr>
</table>


<table align="center">
<xsl:choose>
<xsl:when test="$action='create'">
<tr><td colspan = "2"><HR></HR></td></tr>
<tr>
<td><input id="CreateButton" class="BGGrey" type="button" value="{$lang.button.create}" onClick="checkPatientRequiredFields()"/></td>
<td><input id="ResetButton" class="BGGrey" type="reset" value="{$lang.button.reset}" /></td>
</tr>
<tr><td colspan = "2"><HR></HR></td></tr>
</xsl:when>
<xsl:otherwise>
<tr><td colspan = "2"><HR></HR></td></tr>
<tr>
<td><input id="SaveButton" class="BGGrey" type="button" value="{$lang.button.save}" onClick="checkPatientRequiredFields()"/></td>
<td><input id="ResetButton" class="BGGrey" type="reset" value="{$lang.button.reset}" /></td>
</tr>
<tr><td colspan = "2"><HR></HR></td></tr>
</xsl:otherwise>
</xsl:choose>
</table>


<script LANGUAGE="JavaScript">

       theTitle = '<xsl:value-of select="$title" />';
       theDay = '<xsl:value-of select="$day" />';
       theMonth = '<xsl:value-of select="$month" />';
       document.forms[0].day.options[theDay].selected='true';
       document.forms[0].day.options[theDay].defaultSelected = 'true';
       document.forms[0].month.options[theMonth].selected='true';
       document.forms[0].month.options[theMonth].defaultSelected = 'true';

       var i=0;
       if( theTitle == "Miss" )
           i=1;
       else if( theTitle == "Mr" )
           i=2;
       else if( theTitle == "Mrs" )
           i=3;
       else if( theTitle == "Ms" )
           i=4;
       else
           i=0;

       document.forms[0].Title.options[i].selected = 'true';
       document.forms[0].Title.options[i].defaultSelected = 'true';


theSex = '<xsl:value-of select="Patient/PatientData/Sex"/>'; if (theSex == 'F') { document.forms[0].Sex[0].checked='true'; document.forms[0].Sex[0].defaultChecked='true'; } else if (theSex == 'M') { document.forms[0].Sex[1].checked='true'; document.forms[0].Sex[1].defaultChecked='true'; }

</script>

</xsl:template>

</xsl:stylesheet>



template 1:

<xsl:template name="js:escape">
<xsl:param name="text"/>
<xsl:apply-templates select="document('replace.xml')/js:escapes/replace[1]" mode="js:escape">
<xsl:with-param name="text" select="$text"/>
</xsl:apply-templates>
</xsl:template>


<xsl:template match="js:escapes/replace" mode="js:escape">
<xsl:param name="text"/>
<xsl:variable name="next" select="following-sibling::replace[contains($text, from)][1]"/>
<xsl:choose>
<xsl:when test="$next">
<xsl:apply-templates select="$next" mode="js:escape">
<xsl:with-param name="substring-before($text, from)"/>
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring-before($text, from)"/>
</xsl:otherwise>
</xsl:choose>
<xsl:copy-of select="to"/>
<xsl:apply-templates select="." mode="js:escape">
<xsl:with-param name="substring-after($text, to)"/>
</xsl:apply-templates>
</xsl:template>


template 2:

<xsl:template name="js:escape">
<xsl:param name="text"/>
<xsl:param name="replacements"/>
<xsl:variable name="first" select="$replacements[1]"/>
<xsl:variable name="rest" select="$replacements[position() > 1]"/>
<xsl:choose>
<xsl:when test="contains($text, string($first/from/child::text()))">
<xsl:message>escape.xsl contains</xsl:message>
<xsl:call-template name="js:escape">
<xsl:with-param name="text" select="substring-before($text, string($first/from/child::text()))"/>
<xsl:with-param name="replacements" select="$rest"/>
</xsl:call-template>
<xsl:copy-of select="$first/to/child::text()"/>
<xsl:call-template name="js:escape">
<xsl:with-param name="text" select="substring-after($text, string($first/from/child::text()))"/>
<xsl:with-param name="replacements" select="$replacements"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="count($rest) > 0">
<xsl:message>escape.xsl rest</xsl:message>
<xsl:call-template name="js:escape">
<xsl:with-param name="text" select="$text"/>
<xsl:with-param name="rest" select="$rest"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:message>escape.xsl otherwise</xsl:message>
<xsl:text><xsl:value-of select="$text"/></xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:template>


sample xml:

<List><Patient patientId="1"><Name><Title>Mr.</Title><FirstName>Arthro</FirstName><LastName>Patient</LastName><MI></MI></Name><MRN>S1130082</MRN><DOB>5/28/1966</DOB><ContactData>&#10; <Address>&#10; <Street>5 Elm Street</Street>&#10; <City>Andover</City>&#10; <State>MA</State>&#10; <Zip>01810</Zip>&#10; </Address>&#10; <Email>Arthro.Patient@xxxxxxxxxxxxxxxx</Email>&#10; <Phone>(978) 749-1000</Phone>&#10; </ContactData><PatientData>&#10; <SSN>022-12-5412</SSN>&#10; <Image></Image>&#10; <Weight>200</Weight>&#10; <Height>72</Height>&#10; <Sex>M</Sex>&#10; </PatientData></Patient><List><Procedure defaultTemplateId="0" patientId="1" procedureId="3" procedureNameId="3" userId="36"><Type>x</Type><PrintType>x</PrintType><Date>9/25/2003</Date><ProcedureData><PreAssessment>x</PreAssessment><PostAssessment></PostAssessment><Location> </Location></ProcedureData></Procedure><Procedure defaultTemplateId="0" patientId="1" procedureId="4" procedureNameId="4" userId="36"><Type>!</Type><PrintType></PrintType><Date>9/25/2003</Date><ProcedureData><PreAssessment>!</PreAssessment><PostAssessment></PostAssessment><Location> </Location></ProcedureData></Procedure><Procedure defaultTemplateId="1" patientId="1" procedureId="1" procedureNameId="1" userId="2"><Type>Anterior Cruciate Ligament Repair</Type><PrintType>Anterior Cruciate Ligament Repair</PrintType><Date>6/16/2003</Date><ProcedureData><PreAssessment>Ligament Tear - Anterior Cruciate Ligament [Medial collateral ligament][Lateral collateral ligament]</PreAssessment><PostAssessment></PostAssessment><Location>Left</Location></ProcedureData></Procedure></List></List>


replacement xml:


<?xml version="1.0" encoding="UTF-8"?>

 <js:escapes xmlns:js="http://javascript.com">
   <replace><from>!</from><to>%21</to></replace>
   <replace><from>&quot;</from><to>%22</to></replace>
   <replace><from>#</from><to>%23</to></replace>
   <replace><from>$</from><to>%24</to></replace>
   <replace><from>%</from><to>%25</to></replace>
   <replace><from>&amp;</from><to>%26</to></replace>
   <replace><from>&apos;</from><to>%27</to></replace>
   <replace><from>(</from><to>%28</to></replace>
   <replace><from>)</from><to>%29</to></replace>
   <replace><from>,</from><to>%2C</to></replace>
   <replace><from>:</from><to>%3A</to></replace>
   <replace><from>;</from><to>%3B</to></replace>
   <replace><from>&lt;</from><to>%3C</to></replace>
   <replace><from>=</from><to>%3D</to></replace>
   <replace><from>&gt;</from><to>%3E</to></replace>
   <replace><from>?</from><to>%3F</to></replace>
   <replace><from>[</from><to>%5B</to></replace>
   <replace><from>\</from><to>%5C</to></replace>
   <replace><from>]</from><to>%5D</to></replace>
   <replace><from>^</from><to>%5E</to></replace>
   <replace><from>`</from><to>%60</to></replace>
   <replace><from>{</from><to>%7B</to></replace>
   <replace><from>|</from><to>%7C</to></replace>
   <replace><from>}</from><to>%7D</to></replace>
   <replace><from>~</from><to>%7E</to></replace>
 </js:escapes>

_________________________________________________________________
Frustrated with dial-up? Get high-speed for as low as $29.95/month (depending on the local service providers in your area). https://broadband.msn.com



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.