XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Rick BomarSubject: Need actual
Author: Rick Bomar
Date: 04 Apr 2007 11:35 AM
Originally Posted: 04 Apr 2007 11:33 AM
How would I setup my xsl to put a literal "space" between a tag if the field is blank? I have attached an example of my xml file and my stylesheet for your review. The Tag I'm interested in is the PRESENT_ON_ADMIT Tag.


UnknownDowntownIP07.xsl
Style Sheet

UnknownTEST07IP.xml
Output xml file

Postnext
Ivan PedruzziSubject: Need actual
Author: Ivan Pedruzzi
Date: 04 Apr 2007 01:00 PM
Rick

Assuming you are talking about the following

<OTHER_DIAG_CODE>
<OTHER_CODE>787.2</OTHER_CODE>
<PRESENT_ON_ADMIT>Y</PRESENT_ON_ADMIT>
</OTHER_DIAG_CODE>

How you would like to be formatted?

Ivan Pedruzzi
Stylus Studio Team

Postnext
Rick BomarSubject: Need actual
Author: Rick Bomar
Date: 04 Apr 2007 04:04 PM
If the data element has a value of "E", then the tag should show like this <PRESENT_ON_ADMIT> </PRESENT_ON_ADMIT>

I tried to setup a list for this field using the ascii value 032 or 255 and it put tabs in the tag.

Postnext
Ivan PedruzziSubject: Need actual
Author: Ivan Pedruzzi
Date: 04 Apr 2007 04:58 PM

replace

<xsl:copy-of select="following-sibling::PRESENT_ON_ADMIT[1]"/>

with

<PRESENT_ON_ADMIT>
<xsl:value-of select="
translate(following-sibling::PRESENT_ON_ADMIT[1], 'E', ' ')"/>
</OTHER_DIAG_CODE>

translate replaces a set of character into another set
http://www.w3.org/TR/xpath#function-translate

Ivan Pedruzzi
Stylus Studio Team
http://www.stylusstudio.com/xml_download.html

Postnext
Rick BomarSubject: Need actual
Author: Rick Bomar
Date: 05 Apr 2007 09:55 AM
I tried your suggestion, but no go. I have attached my input file along with my updated stylesheet.


Unknownah882px.txt
Text Input file

UnknownDowntownIP07(1).xsl
Updated Stylesheet

Postnext
Ivan PedruzziSubject: Need actual
Author: Ivan Pedruzzi
Date: 05 Apr 2007 10:39 AM

Which converter are you using to converter the text file?

Ivan Pedruzzi
Stylus Studio Team

Postnext
Rick BomarSubject: Need actual
Author: Rick Bomar
Date: 05 Apr 2007 01:24 PM
Here is my converter...


UnknownDowntownIP07.conv
conv file

Postnext
Ivan PedruzziSubject: Need actual
Author: Ivan Pedruzzi
Date: 05 Apr 2007 02:08 PM

The proposed solution seems to work with your data. Please uzip the attached file and try

Ivan Pedruzzi
Stylus Studio Team


DocumentRickBomar.zip

Postnext
Rick BomarSubject: Need actual
Author: Rick Bomar
Date: 06 Apr 2007 11:09 AM
Originally Posted: 06 Apr 2007 11:08 AM
Ivan, your code did work. I tried to dup your code to another Tag line, <EXTERNAL_CAUSE> and it is working, however, the tags are being duplicated at the end of the file. I have attached my output file and my stylesheet for your review. Thanks for your help.


UnknownDowntownIP07(2).xsl
Stylesheet

UnknownTEST07IP(1).xml
Output results file

Postnext
Ivan PedruzziSubject: Need actual
Author: Ivan Pedruzzi
Date: 07 Apr 2007 12:57 AM

It sounds like you have copied verbatim what did for OTHER_DIAG_CODE.
Is that what you need?

<xsl:for-each select="EXTERNAL_CAUSE">
<xsl:copy-of select="." />
<PRESENT_ON_ADMIT>
<xsl:value-of select="translate(
following-sibling::PRESENT_ON_ADMIT[1],'E',' ')" />
</PRESENT_ON_ADMIT>
</xsl:for-each select="EXTERNAL_CAUSE">


If you need to generate EXTERNAL_CAUSE do just the following

<xsl:for-each select="EXTERNAL_CAUSE">
<xsl:copy>
<xsl:value-of select="translate(.,'E',' ')" />
</xsl:copy>
</xsl:for-each>



Ivan Pedruzzi
Stylus Studio Team

Postnext
Rick BomarSubject: Need actual
Author: Rick Bomar
Date: 09 Apr 2007 11:02 AM
No, not exactly. Look at my out put file.
<ADMIT_DIAGNOSIS>959.09</ADMIT_DIAGNOSIS>
<EXTERNAL_CAUSE>E823.0</EXTERNAL_CAUSE>
<PRESENT_ON_ADMIT>E</PRESENT_ON_ADMIT>...THIS SHOULD SHOW > <
<EXTERNAL_CAUSE>E849.8</EXTERNAL_CAUSE>
<PRESENT_ON_ADMIT>E</PRESENT_ON_ADMIT>...THIS SHOULD SHOW > <
<ARRIVAL_HOUR>04</ARRIVAL_HOUR>
<PRESENT_ON_ADMIT> </PRESENT_ON_ADMIT>..THIS LINE SHOULD REPLACE ABOVE
<PRESENT_ON_ADMIT> </PRESENT_ON_ADMIT>..THIS LINE SHOULD REPLACE ABOVE

The code I added is replacing E with a blank but putting the tag at the end of the record when it should be replacing the value of the original tag.


UnknownDowntownIP07(3).xsl
Stylesheet

UnknownTEST07IP(2).xml
Output file

Unknownah882px(1).txt
Input file

Postnext
Ivan PedruzziSubject: Need actual
Author: Ivan Pedruzzi
Date: 09 Apr 2007 02:44 PM


This is because you are not checking if there is PRESENT_ON_ADMIT element that follows EXTERNAL_CAUSE

change

<xsl:for-each select="EXTERNAL_CAUSE">

to
<xsl:for-each select="EXTERNAL_CAUSE[following-sibling::PRESENT_ON_ADMIT[1]]">


Ivan Pedruzzi
Stylus Studio Team

Postnext
Rick BomarSubject: Need actual
Author: Rick Bomar
Date: 09 Apr 2007 03:29 PM
Originally Posted: 09 Apr 2007 03:09 PM
After making your suggested change, it is still putting the modified tags at the END of the file instead of replacing the tag where it belongs. I believe the problem lies in the following line:
<xsl:copy-of select="ATTENDING_PHYS_ID/following-sibling::*"/>

The probelm is there are 26 TAGS after <ATTENDING_PHYS_ID> before I get to my first <EXTERNAL_CAUSE> tag. Then I need to process the <PRESENT_ON_ADMIT> tag. then, copy the rest of the file in normal order of the tags to the end of record.
HERES MY CODE...

<xsl:copy-of select="ATTENDING_PHYS_ID"/>
<xsl:copy-of select="ATTENDING_PHYS_ID/following-sibling::*"/>
<xsl:for-each select="EXTERNAL_CAUSE[following-ibling::PRESENT_ON_ADMIT1]]">
<PRESENT_ON_ADMIT>
<xsl:value-of select="translate(following-sibling::PRESENT_ON_ADMIT[1],'E',' ')" />
</PRESENT_ON_ADMIT>
</xsl:for-each>

Postnext
Ivan PedruzziSubject: Need actual
Author: Ivan Pedruzzi
Date: 09 Apr 2007 03:38 PM

Before waisting additional bandwidth, please post an example with a single complete RECORD and a version of how it should be.

Ivan

Postnext
Rick BomarSubject: Need actual
Author: Rick Bomar
Date: 09 Apr 2007 03:46 PM
Originally Posted: 09 Apr 2007 03:42 PM
Bad Record.......
<RECORD id="00100032234">
<AHCA_NUM>0000100088</AHCA_NUM>
<PATIENT_SSN>999999999</PATIENT_SSN>
<PATIENT_RACE>4</PATIENT_RACE>
<PATIENT_BIRTHDATE>1999-99-99</PATIENT_BIRTHDATE>
<PATIENT_SEX>2</PATIENT_SEX>
<PATIENT_ZIP>99999</PATIENT_ZIP>
<ADMIT_TYPE>1</ADMIT_TYPE>
<ADMIT_SOURCE>07</ADMIT_SOURCE>
<ADMIT_DATE>2007-03-11</ADMIT_DATE>
<DISCH_DATE>2007-03-12</DISCH_DATE>
<DISCH_STATUS>01</DISCH_STATUS>
<PRINC_DIAG_CODE>959.09</PRINC_DIAG_CODE>
<OTHER_DIAG_CODE>
<OTHER_CODE>787.2</OTHER_CODE>
<PRESENT_ON_ADMIT>Y</PRESENT_ON_ADMIT>
</OTHER_DIAG_CODE>
<OTHER_DIAG_CODE>
<OTHER_CODE>784.49</OTHER_CODE>
<PRESENT_ON_ADMIT>Y</PRESENT_ON_ADMIT>
</OTHER_DIAG_CODE>
<PRIN_PROC_CODE>
<PROC_CODE>31.42</PROC_CODE>
<PROC_DATE>2007-03-11</PROC_DATE>
</PRIN_PROC_CODE>
<ATTENDING_PHYS_ID>ME92195</ATTENDING_PHYS_ID>
<OPERATING_PHYS_ID>ME56292</OPERATING_PHYS_ID>
<ROOM_BOARD_CHARGES>0</ROOM_BOARD_CHARGES>
<NURSERY_CHARGES>0</NURSERY_CHARGES>
<L3_NURSERY_CHARGES>0</L3_NURSERY_CHARGES>
<INTENSIVE_CARE_CHARGES>1296</INTENSIVE_CARE_CHARGES>
<CORONARY_CARE_CHARGES>0</CORONARY_CARE_CHARGES>
<PHARMACY_CHARGES>2151</PHARMACY_CHARGES>
<MED_SURG_SUPPLY_CHARGES>439</MED_SURG_SUPPLY_CHARGES>
<LAB_CHARGES>611</LAB_CHARGES>
<RADIOLOGY_IMAGING_CHARGES>9223</RADIOLOGY_IMAGING_CHARGES>
<CARDIOLOGY_CHARGES>0</CARDIOLOGY_CHARGES>
<RESPIRATORY_PULMONARY_CHARGES>302</RESPIRATORY_PULMONARY_CHARGES>
<OPER_ROOM_CHARGES>0</OPER_ROOM_CHARGES>
<ANESTHESIA_CHARGES>0</ANESTHESIA_CHARGES>
<RECOVERY_ROOM_CHARGES>0</RECOVERY_ROOM_CHARGES>
<LABOR_ROOM_CHARGES>0</LABOR_ROOM_CHARGES>
<ER_ROOM_CHARGES>943</ER_ROOM_CHARGES>
<TRAUMA_RESPONSE_CHARGES>0</TRAUMA_RESPONSE_CHARGES>
<TREATMENT_OBSERVATION_ROOM_CHARGES>0</TREATMENT_OBSERVATION_ROOM_CHARGES>
<BEHAVIORAL_HEALTH_CHARGES>0</BEHAVIORAL_HEALTH_CHARGES>
<ONCOLOGY_CHARGES>0</ONCOLOGY_CHARGES>
<PHYS_OCC_THERAPY_CHARGES>0</PHYS_OCC_THERAPY_CHARGES>
<OTHER_CHARGES>0</OTHER_CHARGES>
<TOTAL_CHARGES>14965</TOTAL_CHARGES>
<INFANT_LINKAGE_ID>000000000</INFANT_LINKAGE_ID>
<ADMIT_DIAGNOSIS>959.09</ADMIT_DIAGNOSIS>
<EXTERNAL_CAUSE>E823.0</EXTERNAL_CAUSE>
<PRESENT_ON_ADMIT>E</PRESENT_ON_ADMIT>
<EXTERNAL_CAUSE>E849.8</EXTERNAL_CAUSE>
<PRESENT_ON_ADMIT>E</PRESENT_ON_ADMIT>
<ARRIVAL_HOUR>04</ARRIVAL_HOUR>
</RECORD>

How it should be....
<RECORD id="00100032234">
<AHCA_NUM>0000100088</AHCA_NUM>
<PATIENT_SSN>999999999</PATIENT_SSN>
<PATIENT_RACE>4</PATIENT_RACE>
<PATIENT_BIRTHDATE>1999-99-99</PATIENT_BIRTHDATE>
<PATIENT_SEX>2</PATIENT_SEX>
<PATIENT_ZIP>99999</PATIENT_ZIP>
<ADMIT_TYPE>1</ADMIT_TYPE>
<ADMIT_SOURCE>07</ADMIT_SOURCE>
<ADMIT_DATE>2007-03-11</ADMIT_DATE>
<DISCH_DATE>2007-03-12</DISCH_DATE>
<DISCH_STATUS>01</DISCH_STATUS>
<PRINC_DIAG_CODE>959.09</PRINC_DIAG_CODE>
<OTHER_DIAG_CODE>
<OTHER_CODE>787.2</OTHER_CODE>
<PRESENT_ON_ADMIT>Y</PRESENT_ON_ADMIT>
</OTHER_DIAG_CODE>
<OTHER_DIAG_CODE>
<OTHER_CODE>784.49</OTHER_CODE>
<PRESENT_ON_ADMIT>Y</PRESENT_ON_ADMIT>
</OTHER_DIAG_CODE>
<PRIN_PROC_CODE>
<PROC_CODE>31.42</PROC_CODE>
<PROC_DATE>2007-03-11</PROC_DATE>
</PRIN_PROC_CODE>
<ATTENDING_PHYS_ID>ME92195</ATTENDING_PHYS_ID>
<OPERATING_PHYS_ID>ME56292</OPERATING_PHYS_ID>
<ROOM_BOARD_CHARGES>0</ROOM_BOARD_CHARGES>
<NURSERY_CHARGES>0</NURSERY_CHARGES>
<L3_NURSERY_CHARGES>0</L3_NURSERY_CHARGES>
<INTENSIVE_CARE_CHARGES>1296</INTENSIVE_CARE_CHARGES>
<CORONARY_CARE_CHARGES>0</CORONARY_CARE_CHARGES>
<PHARMACY_CHARGES>2151</PHARMACY_CHARGES>
<MED_SURG_SUPPLY_CHARGES>439</MED_SURG_SUPPLY_CHARGES>
<LAB_CHARGES>611</LAB_CHARGES>
<RADIOLOGY_IMAGING_CHARGES>9223</RADIOLOGY_IMAGING_CHARGES>
<CARDIOLOGY_CHARGES>0</CARDIOLOGY_CHARGES>
<RESPIRATORY_PULMONARY_CHARGES>302</RESPIRATORY_PULMONARY_CHARGES>
<OPER_ROOM_CHARGES>0</OPER_ROOM_CHARGES>
<ANESTHESIA_CHARGES>0</ANESTHESIA_CHARGES>
<RECOVERY_ROOM_CHARGES>0</RECOVERY_ROOM_CHARGES>
<LABOR_ROOM_CHARGES>0</LABOR_ROOM_CHARGES>
<ER_ROOM_CHARGES>943</ER_ROOM_CHARGES>
<TRAUMA_RESPONSE_CHARGES>0</TRAUMA_RESPONSE_CHARGES>
<TREATMENT_OBSERVATION_ROOM_CHARGES>0</TREATMENT_OBSERVATION_ROOM_CHARGES>
<BEHAVIORAL_HEALTH_CHARGES>0</BEHAVIORAL_HEALTH_CHARGES>
<ONCOLOGY_CHARGES>0</ONCOLOGY_CHARGES>
<PHYS_OCC_THERAPY_CHARGES>0</PHYS_OCC_THERAPY_CHARGES>
<OTHER_CHARGES>0</OTHER_CHARGES>
<TOTAL_CHARGES>14965</TOTAL_CHARGES>
<INFANT_LINKAGE_ID>000000000</INFANT_LINKAGE_ID>
<ADMIT_DIAGNOSIS>959.09</ADMIT_DIAGNOSIS>
<EXTERNAL_CAUSE>E823.0</EXTERNAL_CAUSE>
<PRESENT_ON_ADMIT> </PRESENT_ON_ADMIT>
<EXTERNAL_CAUSE>E849.8</EXTERNAL_CAUSE>
<PRESENT_ON_ADMIT> </PRESENT_ON_ADMIT>
<ARRIVAL_HOUR>04</ARRIVAL_HOUR>
</RECORD>


UnknownDowntownIP07(4).xsl

Postnext
Ivan PedruzziSubject: Need actual
Author: Ivan Pedruzzi
Date: 09 Apr 2007 05:17 PM
Rick

When i apply the styleshet to the data you have posted I get an output that does not contain any

<PRESENT_ON_ADMIT>E</PRESENT_ON_ADMIT>

In your input document there is not such element PRESENT_ON_ADMIT with value E. However there are other values that you may need to escape like ., -, V, A, U ect.

A single template should do the work, see the attached solution.


Ivan Pedruzzi
Stylus Studio Team


DocumentDowntownIP07(5).xsl

Postnext
Rick BomarSubject: Need actual
Author: Rick Bomar
Date: 11 Apr 2007 09:33 AM
Originally Posted: 11 Apr 2007 09:31 AM
I don't think you are following what it is I need. If you look at the following record, after <ADMIT_DIAGNOSIS>, If the following <PRESENT_ON_ADMIT> is equal to an 'E' and only and 'E', then replace the 'E' with a ' '(blank). The ,PRESENT_ON_ADMIT> tag occurs three times, after each <EXTERNAL_CAUSE> tag, if there was an External Cause value, if no value it does not output.

<AHCA_NUM>0000100088</AHCA_NUM>
<RECORD_ID>00100032234</RECORD_ID>
<PATIENT_SSN>590923195</PATIENT_SSN>
<PATIENT_RACE>4</PATIENT_RACE>
<PATIENT_BIRTHDATE>1989-12-31</PATIENT_BIRTHDATE>
<PATIENT_SEX>2</PATIENT_SEX>
<PATIENT_ZIP>32219</PATIENT_ZIP>
<ADMIT_TYPE>1</ADMIT_TYPE>
<ADMIT_SOURCE>07</ADMIT_SOURCE>
<ADMIT_DATE>2007-03-11</ADMIT_DATE>
<DISCH_DATE>2007-03-12</DISCH_DATE>
<DISCH_STATUS>01</DISCH_STATUS>
<PRINC_PAYOR_CODE>G</PRINC_PAYOR_CODE>
<PRINC_DIAG_CODE>959.09</PRINC_DIAG_CODE>
<PRESENT_ON_ADMIT>Y</PRESENT_ON_ADMIT>
<OTHER_CODE>787.2</OTHER_CODE>
<PRESENT_ON_ADMIT>Y</PRESENT_ON_ADMIT>
<OTHER_CODE>784.49</OTHER_CODE>
<PRESENT_ON_ADMIT>Y</PRESENT_ON_ADMIT>
<PRINC_PROC_CODE>31.42</PRINC_PROC_CODE>
<PRINC_PROC_DATE>2007-03-11</PRINC_PROC_DATE>
<ATTENDING_PHYS_ID>ME92195</ATTENDING_PHYS_ID>
<OPERATING_PHYS_ID>ME56292</OPERATING_PHYS_ID>
<ROOM_BOARD_CHARGES>0</ROOM_BOARD_CHARGES>
<NURSERY_CHARGES>0</NURSERY_CHARGES>
<L3_NURSERY_CHARGES>0</L3_NURSERY_CHARGES>
<INTENSIVE_CARE_CHARGES>1296</INTENSIVE_CARE_CHARGES>
<CORONARY_CARE_CHARGES>0</CORONARY_CARE_CHARGES>
<PHARMACY_CHARGES>2151</PHARMACY_CHARGES>
<MED_SURG_SUPPLY_CHARGES>439</MED_SURG_SUPPLY_CHARGES>
<LAB_CHARGES>611</LAB_CHARGES>
<RADIOLOGY_IMAGING_CHARGES>9223</RADIOLOGY_IMAGING_CHARGES>
<CARDIOLOGY_CHARGES>0</CARDIOLOGY_CHARGES>
<RESPIRATORY_PULMONARY_CHARGES>302</RESPIRATORY_PULMONARY_CHARGES>
<OPER_ROOM_CHARGES>0</OPER_ROOM_CHARGES>
<ANESTHESIA_CHARGES>0</ANESTHESIA_CHARGES>
<RECOVERY_ROOM_CHARGES>0</RECOVERY_ROOM_CHARGES>
<LABOR_ROOM_CHARGES>0</LABOR_ROOM_CHARGES>
<ER_ROOM_CHARGES>943</ER_ROOM_CHARGES>
<TRAUMA_RESPONSE_CHARGES>0</TRAUMA_RESPONSE_CHARGES>
<TREATMENT_OBSERVATION_ROOM_CHARGES>0</TREATMENT_OBSERVATION_ROOM_CHARGES>
<BEHAVIORAL_HEALTH_CHARGES>0</BEHAVIORAL_HEALTH_CHARGES>
<ONCOLOGY_CHARGES>0</ONCOLOGY_CHARGES>
<PHYS_OCC_THERAPY_CHARGES>0</PHYS_OCC_THERAPY_CHARGES>
<OTHER_CHARGES>0</OTHER_CHARGES>
<TOTAL_CHARGES>14965</TOTAL_CHARGES>
<INFANT_LINKAGE_ID>000000000</INFANT_LINKAGE_ID>
<ADMIT_DIAGNOSIS>959.09</ADMIT_DIAGNOSIS>
<EXTERNAL_CAUSE>E823.0</EXTERNAL_CAUSE>
<PRESENT_ON_ADMIT>E</PRESENT_ON_ADMIT>
<EXTERNAL_CAUSE>E849.8</EXTERNAL_CAUSE>
<PRESENT_ON_ADMIT>E</PRESENT_ON_ADMIT>
<ARRIVAL_HOUR>04</ARRIVAL_HOUR>
</RECORD>


UnknownDowntownIP07(6).xsl

Posttop
Rick BomarSubject: Need actual
Author: Rick Bomar
Date: 18 Apr 2007 09:41 AM
Ok, Ivan, I still need help. After adding your changes to my xsl, I am still not able to translate <PRESENT_ON_ADMIT> if it contains an 'E' character to a ' ' blank. This is only a one character field and should be translated to a blank if it contains an 'E'. As you can see in my final Output file, TEST 07 IP.xml, the <PRESENT_ON_ADMIT> for <OTHER_CODE> works fine. However, the <PRESENT_ON_ADMIT> which comes after the <ADMIT_DIAGNOSIS> is not working. Please help me solve this problem.

Thank You for your patience.


Unknownah882px(2).txt
Text Input file

UnknownDowntownIP07(1).conv
Adapter for Text Input file

UnknownDowntownIP07(7).xsl
Stylesheet

UnknownXSLInput(2).xml
Intermediate file from Adapter conversio

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.