INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Clueless but need Stylesheet...

RE: Clueless but need Stylesheet...

You can find an XSLT tutorial at http://www.w3schools.com/xsl/default.asp.

For a command line XSL processor, you can download msxsl from the Microsoft web site. For a better experience, download XMLSpy or Stylus Studio and use one of their free evaluation periods.

The Microsoft knowledgebase article has an XSLT which will process your XML, turning attributes into elements of the same name, viz

CODE -->

<TestCode Ext-ID="30" Status="F" Type="CBCDIF" Related-Ext-ID="43"> 
will be translated to:

CODE -->

<TestCode>
     <Ext-ID>30</Ext-ID>
     <Status>F</Status>
     <Type>CBCDIF</Type>
     <Related-Ext-ID>43</Related-Ext-ID>
   ...

</TestCode> 

It appears you are looking for something a bit more but you are not doing a satisfactory job of describing what type of XML to which you wish to transform your input. I understand that this is not an area of expertise for you, but give it another try.

Tom Morrison
Micro Focus

RE: Clueless but need Stylesheet...

(OP)
Finally getting back to this...

Not sure about the wording but I think I want to strip away certain parent elements to end with a common larger element and change timestamp attributes to regular text.

I really am so far removed from proper XML jargon I doubt I can talk intelligently about it... So here is an explanation of what I get based on processing the XML and issues.

My biggest issue is that the Timestamp Values are not coming in on my import (under Accession however the report header does). Another issue is that there are effectively a lot of implicit 1 to 1 relationships in the data and having multiple groupings that end up as separate identities / tables is cumbersome but I can cope if necessary.

When I import I have the following identities / tables...

AccessionHeader - Missing timestamp data - data is needed as part of lab / testcode
Address (I did play with removing tags and got this to die manually; columns are then part of clinic and lablocation)
Clinic
Lablocation
Pet -Secondary / FK data I need
ReportHeader
TestCode - Principle data I need
UnitCode - Not sure I understand where this one is coming from. It has CBC and Albumin values.

So from where I sit there ideally would be two 'tables' one for testcode which has the many side and one for everything else which has the one side... But I'd settle for getting rid of address.

The other anamoly I have is that for the test code table I have a units column that has markup encoding... So for the Name "WBC" I have units "10<sup>3</sup>/<font face="symbol">&#109;</font>L".
This is the least annoying of issues I can always eyeball the source presentation and make replacements as necessary.

Hopefully that all makes sense.

RE: Clueless but need Stylesheet...

(OP)
The question is what does the implied stylesheet look like? I bolded a couple key changes. So I removed the block for address so address fields are in line with the parent rather than a separate type/table and changed some timestamps to values... Honestly all timestamps could go to values.

Before (as displayed in IE8...

CODE

<?xml version="1.0" encoding="utf-8" ?> 
- <LabReport>
- <ReportHeader>
  <Requested-By /> 
  <Requested-On>04/01/2013 10:20 AM</Requested-On> 
  </ReportHeader>
- <Clinic AccountNumber="1234" Ext-ID="56789" Status="Active">
  <Name>Fruitcicle</Name> 
- <Address>
  <Street>123 Seasame Street</Street> 
  <Street /> 
  <City>Springfield</City> 
  <StateProv>ST</StateProv> 
  <PostalCode>45040</PostalCode> 
  <Country>USA</Country> 
  </Address>
  <Phone>555-555-5555</Phone> 
  <Fax>555-555-5555</Fax> 
  <Rtf-Version>2</Rtf-Version> 
  </Clinic>
- <LabLocation LabLocationId="08" LabId="5">
  <LocationCode>M</LocationCode> 
  <LocationName>Lab Processing</LocationName> 
- <Address>
  <Street>666 Williams Street</Street> 
  <City>Fruit Cake</City> 
  <StateProv>ST</StateProv> 
  <PostalCode>10000</PostalCode> 
  <Country>USA</Country> 
  </Address>
  <LocationPhone>555-555-5555</LocationPhone> 
  </LabLocation>
- <Accession Acc-Result-ID="123456789" Order-Status="F" Lab-ID="2" Location-ID="10" LabClinicExt-ID="14509">
- <AccessionHeader>
  <Accession-ID Type="Clinic-AccID" ID="98612" /> 
  <Accession-ID Type="Chart-ID" ID="835" /> 
  <Accession-ID Type="Lab-AccID" ID="MEEA43117189" /> 
  <TimeStamp Type="Order Received DateTime" Value="03/24/2013" /> 
  <TimeStamp Type="Latest Results Received DateTime" Value="03/24/2013 07:28 PM" /> 
  <TimeStamp Type="Printed DateTime" Value="03/24/2013 05:35 PM" /> 

- <Pet>
  <Name>Jack</Name> 
  <Age>19W</Age> 
  <Sex>M</Sex> 
  <Species Ext-ID="C">Canine</Species> 
  <Breed Ext-ID="LABRT" /> 
  <Owner>Merry</Owner> 
  <Doctor>Spam</Doctor> 
  </Pet>
  </AccessionHeader>
- <UnitCode Ext-ID="100" Status="F" Order-Control-Status="RE" Type="CBC">
  <Name>CBC</Name> 
  <TimeStamp Type="Released Datetime" Value="03/24/2013 07:42 PM" /> 
  <TimeStamp Type="Viewed Datetime" Value="03/24/2013 06:51 PM" /> 
- <TestCode Ext-ID="10" Status="F">
  <Name>WBC</Name> 
  <Value>9.0</Value> 
- <Units>
- <![CDATA[ 10<sup>3</sup>/<font face="symbol">m</font>L
  ]]> 
  </Units>
  <Range>4.0-15.5</Range> 
  </TestCode>
- <TestCode Ext-ID="11" Status="F">
  <Name>RBC</Name> 
  <Value>5.75</Value> 
- <Units>
- <![CDATA[ 10<sup>6</sup>/<font face="symbol">m</font>L
  ]]> 
  </Units>
  <Range>4.8-9.3</Range> 
  </TestCode>
- <TestCode Ext-ID="12" Status="F">
  <Name>Hemoglobin</Name> 
  <Value>13.2</Value> 
- <Units>
- <![CDATA[ g/dL
  ]]> 
  </Units>
  <Range>12.1-20.3</Range> 
  </TestCode>
- <TestCode Ext-ID="13" Status="F">
  <Name>Hematocrit</Name> 
  <Value>40.7</Value> 
- <Units>
- <![CDATA[ %
  ]]> 
  </Units>
  <Range>36-60</Range> 
  </TestCode>
- <TestCode Ext-ID="14" Status="F">
  <Name>MCV</Name> 
  <Value>71</Value> 
- <Units>
- <![CDATA[ fL
  ]]> 
  </Units>
  <Range>58-79</Range> 
  </TestCode>
- <TestCode Ext-ID="15" Status="F">
  <Name>MCH</Name> 
  <Value>22.0</Value> 
- <Units>
- <![CDATA[ pg
  ]]> 
  </Units>
  <Range>19-28</Range> 
  </TestCode>
- <TestCode Ext-ID="16" Status="F">
  <Name>MCHC</Name> 
  <Value>32.4</Value> 
- <Units>
- <![CDATA[ g/dL
  ]]> 
  </Units>
  <Range>30-38</Range> 
  </TestCode>
- <TestCode Ext-ID="25" Status="F">
  <Name>Platelet Count</Name> 
  <Value>233</Value> 
- <Units>
- <![CDATA[ 10<sup>3</sup>/<font face="symbol">m</font>L
  ]]> 
  </Units>
  <Range>170-400</Range> 
  </TestCode>
- <TestCode Ext-ID="26" Status="F">
  <Name>Platelet EST</Name> 
  <Value>Adequate</Value> 
  <Units /> 
  <Range>ADEQUATE</Range> 
  </TestCode>
- <TestCode Ext-ID="28" Status="F" Abnormal="L" Type="CBCDIF" Related-Ext-ID="41">
  <Name>Neutrophils</Name> 
  <Value>45</Value> 
- <Units>
- <![CDATA[ %
  ]]> 
  </Units>
  <Range>60-77</Range> 
  </TestCode>
- <TestCode Ext-ID="30" Status="F" Type="CBCDIF" Related-Ext-ID="43">
  <Name>Bands</Name> 
  <Value>0</Value> 
- <Units>
- <![CDATA[ %
  ]]> 
  </Units>
  <Range>0-3</Range> 
  </TestCode>
- <TestCode Ext-ID="31" Status="F" Abnormal="H" Type="CBCDIF" Related-Ext-ID="44">
  <Name>Lymphocytes</Name> 
  <Value>45</Value> 
- <Units>
- <![CDATA[ %
  ]]> 
  </Units>
  <Range>12-30</Range> 
  </TestCode>
- <TestCode Ext-ID="32" Status="F" Type="CBCDIF" Related-Ext-ID="45">
  <Name>Monocytes</Name> 
  <Value>5</Value> 
- <Units>
- <![CDATA[ %
  ]]> 
  </Units>
  <Range>3-10</Range> 
  </TestCode>
- <TestCode Ext-ID="33" Status="F" Type="CBCDIF" Related-Ext-ID="46">
  <Name>Eosinophils</Name> 
  <Value>3</Value> 
- <Units>
- <![CDATA[ %
  ]]> 
  </Units>
  <Range>2-10</Range> 
  </TestCode>
- <TestCode Ext-ID="34" Status="F" Type="CBCDIF" Related-Ext-ID="47">
  <Name>Basophils</Name> 
  <Value>1</Value> 
- <Units>
- <![CDATA[ %
  ]]> 
  </Units>
  <Range>0-1</Range> 
  </TestCode>
- <TestCode Ext-ID="41" Status="F" Type="CBCABS">
  <Name>Absolute Neutrophils</Name> 
  <Value>3780</Value> 
- <Units>
- <![CDATA[ /uL
  ]]> 
  </Units>
  <Range>2060-10600</Range> 
  </TestCode>
- <TestCode Ext-ID="43" Status="F" Type="CBCABS">
  <Name>Absolute Bands</Name> 
  <Value>0</Value> 
- <Units>
- <![CDATA[ /uL
  ]]> 
  </Units>
  <Range>0-300</Range> 
  </TestCode>
- <TestCode Ext-ID="44" Status="F" Type="CBCABS">
  <Name>Absolute Lymphocytes</Name> 
  <Value>3780</Value> 
- <Units>
- <![CDATA[ /uL
  ]]> 
  </Units>
  <Range>690-4500</Range> 
  </TestCode>
- <TestCode Ext-ID="44" Status="F" Type="CBCABS">
  <Name>Absolute Monocytes</Name> 
  <Value>420</Value> 
- <Units>
- <![CDATA[ /uL
  ]]> 
  </Units>
  <Range>0-840</Range> 
  </TestCode>
- <TestCode Ext-ID="46" Status="F" Type="CBCABS">
  <Name>Absolute Eosinophils</Name> 
  <Value>336</Value> 
- <Units>
- <![CDATA[ /uL
  ]]> 
  </Units>
  <Range>0-1200</Range> 
  </TestCode>
- <TestCode Ext-ID="47" Status="F" Type="CBCABS">
  <Name>Absolute Basophils</Name> 
  <Value>84</Value> 
- <Units>
- <![CDATA[ /uL
  ]]> 
  </Units>
  <Range>0-150</Range> 
  </TestCode>
  </UnitCode>
- <UnitCode Ext-ID="1" Status="F" Order-Control-Status="RE">
  <Name>Albumin</Name> 
  <TimeStamp Type="Released Datetime" Value="03/24/2013 07:28 PM" /> 
  <TimeStamp Type="Viewed Datetime" Value="03/24/2013 05:35 PM" /> 
- <TestCode Ext-ID="1001" Status="F">
  <Name>Albumin</Name> 
  <Value>3.1</Value> 
- <Units>
- <![CDATA[ g/dL
  ]]> 
  </Units>
  <Range>2.7-4.4</Range> 
  </TestCode>
- <TestCode Ext-ID="11067" Status="F">
  <Name>Comment</Name> 
  <Value /> 
  <Units /> 
  <Range /> 
- <Comment>
- <![CDATA[ Hemolysis 2+. No significant analyte interference.
  ]]> 
  </Comment>
  </TestCode>
  </UnitCode>
  </Accession>
  </LabReport> 

After...

CODE

<?xml version="1.0" encoding="utf-8" ?> 
- <LabReport>
- <ReportHeader>
  <Requested-By /> 
  <Requested-On>04/01/2013 10:20 AM</Requested-On> 
  </ReportHeader>
- <Clinic AccountNumber="1234" Ext-ID="56789" Status="Active">
  <Name>Fruitcicle</Name> 
  <Street>123 Seasame Street</Street> 
  <Street /> 
  <City>Springfield</City> 
  <StateProv>ST</StateProv> 
  <PostalCode>45040</PostalCode> 
  <Country>USA</Country> 
  <Phone>555-555-5555</Phone> 
  <Fax>555-555-5555</Fax> 
  <Rtf-Version>2</Rtf-Version> 
  </Clinic>
- <LabLocation LabLocationId="08" LabId="5">
  <LocationCode>M</LocationCode> 
  <LocationName>Lab Processing</LocationName> 
  <Street>666 Williams Street</Street> 
  <City>Fruit Cake</City> 
  <StateProv>ST</StateProv> 
  <PostalCode>10000</PostalCode> 
  <Country>USA</Country> 
  <LocationPhone>555-555-5555</LocationPhone> 
  </LabLocation>
- <Accession Acc-Result-ID="123456789" Order-Status="F" Lab-ID="2" Location-ID="10" LabClinicExt-ID="14509">
- <AccessionHeader>
  <Accession-ID Type="Clinic-AccID" ID="98612" /> 
  <Accession-ID Type="Chart-ID" ID="835" /> 
  <Accession-ID Type="Lab-AccID" ID="MEEA43117189" /> 
  <Order_Received>03/24/2013</Order_Received> 
  <Latest_Results_Received>03/24/2013 07:28 PM</Latest_Results_Received> 
  <Printed>03/24/2013 05:35 PM</Printed> 
  </AccessionHeader>
- <Pet>
  <Name>Jack</Name> 
  <Age>19W</Age> 
  <Sex>M</Sex> 
  <Species Ext-ID="C">Canine</Species> 
  <Breed Ext-ID="LABRT" /> 
  <Owner>Merry</Owner> 
  <Doctor>Spam</Doctor> 
  </Pet>
- <UnitCode Ext-ID="100" Status="F" Order-Control-Status="RE" Type="CBC">
  <Name>CBC</Name> 
  <TimeStamp Type="Released Datetime" Value="03/24/2013 07:42 PM" /> 
  <TimeStamp Type="Viewed Datetime" Value="03/24/2013 06:51 PM" /> 
- <TestCode Ext-ID="10" Status="F">
  <Name>WBC</Name> 
  <Value>9.0</Value> 
- <Units>
- <![CDATA[ 10<sup>3</sup>/<font face="symbol">m</font>L
  ]]> 
  </Units>
  <Range>4.0-15.5</Range> 
  </TestCode>
- <TestCode Ext-ID="11" Status="F">
  <Name>RBC</Name> 
  <Value>5.75</Value> 
- <Units>
- <![CDATA[ 10<sup>6</sup>/<font face="symbol">m</font>L
  ]]> 
  </Units>
  <Range>4.8-9.3</Range> 
  </TestCode>
- <TestCode Ext-ID="12" Status="F">
  <Name>Hemoglobin</Name> 
  <Value>13.2</Value> 
- <Units>
- <![CDATA[ g/dL
  ]]> 
  </Units>
  <Range>12.1-20.3</Range> 
  </TestCode>
- <TestCode Ext-ID="13" Status="F">
  <Name>Hematocrit</Name> 
  <Value>40.7</Value> 
- <Units>
- <![CDATA[ %
  ]]> 
  </Units>
  <Range>36-60</Range> 
  </TestCode>
- <TestCode Ext-ID="14" Status="F">
  <Name>MCV</Name> 
  <Value>71</Value> 
- <Units>
- <![CDATA[ fL
  ]]> 
  </Units>
  <Range>58-79</Range> 
  </TestCode>
- <TestCode Ext-ID="15" Status="F">
  <Name>MCH</Name> 
  <Value>22.0</Value> 
- <Units>
- <![CDATA[ pg
  ]]> 
  </Units>
  <Range>19-28</Range> 
  </TestCode>
- <TestCode Ext-ID="16" Status="F">
  <Name>MCHC</Name> 
  <Value>32.4</Value> 
- <Units>
- <![CDATA[ g/dL
  ]]> 
  </Units>
  <Range>30-38</Range> 
  </TestCode>
- <TestCode Ext-ID="25" Status="F">
  <Name>Platelet Count</Name> 
  <Value>233</Value> 
- <Units>
- <![CDATA[ 10<sup>3</sup>/<font face="symbol">m</font>L
  ]]> 
  </Units>
  <Range>170-400</Range> 
  </TestCode>
- <TestCode Ext-ID="26" Status="F">
  <Name>Platelet EST</Name> 
  <Value>Adequate</Value> 
  <Units /> 
  <Range>ADEQUATE</Range> 
  </TestCode>
- <TestCode Ext-ID="28" Status="F" Abnormal="L" Type="CBCDIF" Related-Ext-ID="41">
  <Name>Neutrophils</Name> 
  <Value>45</Value> 
- <Units>
- <![CDATA[ %
  ]]> 
  </Units>
  <Range>60-77</Range> 
  </TestCode>
- <TestCode Ext-ID="30" Status="F" Type="CBCDIF" Related-Ext-ID="43">
  <Name>Bands</Name> 
  <Value>0</Value> 
- <Units>
- <![CDATA[ %
  ]]> 
  </Units>
  <Range>0-3</Range> 
  </TestCode>
- <TestCode Ext-ID="31" Status="F" Abnormal="H" Type="CBCDIF" Related-Ext-ID="44">
  <Name>Lymphocytes</Name> 
  <Value>45</Value> 
- <Units>
- <![CDATA[ %
  ]]> 
  </Units>
  <Range>12-30</Range> 
  </TestCode>
- <TestCode Ext-ID="32" Status="F" Type="CBCDIF" Related-Ext-ID="45">
  <Name>Monocytes</Name> 
  <Value>5</Value> 
- <Units>
- <![CDATA[ %
  ]]> 
  </Units>
  <Range>3-10</Range> 
  </TestCode>
- <TestCode Ext-ID="33" Status="F" Type="CBCDIF" Related-Ext-ID="46">
  <Name>Eosinophils</Name> 
  <Value>3</Value> 
- <Units>
- <![CDATA[ %
  ]]> 
  </Units>
  <Range>2-10</Range> 
  </TestCode>
- <TestCode Ext-ID="34" Status="F" Type="CBCDIF" Related-Ext-ID="47">
  <Name>Basophils</Name> 
  <Value>1</Value> 
- <Units>
- <![CDATA[ %
  ]]> 
  </Units>
  <Range>0-1</Range> 
  </TestCode>
- <TestCode Ext-ID="41" Status="F" Type="CBCABS">
  <Name>Absolute Neutrophils</Name> 
  <Value>3780</Value> 
- <Units>
- <![CDATA[ /uL
  ]]> 
  </Units>
  <Range>2060-10600</Range> 
  </TestCode>
- <TestCode Ext-ID="43" Status="F" Type="CBCABS">
  <Name>Absolute Bands</Name> 
  <Value>0</Value> 
- <Units>
- <![CDATA[ /uL
  ]]> 
  </Units>
  <Range>0-300</Range> 
  </TestCode>
- <TestCode Ext-ID="44" Status="F" Type="CBCABS">
  <Name>Absolute Lymphocytes</Name> 
  <Value>3780</Value> 
- <Units>
- <![CDATA[ /uL
  ]]> 
  </Units>
  <Range>690-4500</Range> 
  </TestCode>
- <TestCode Ext-ID="44" Status="F" Type="CBCABS">
  <Name>Absolute Monocytes</Name> 
  <Value>420</Value> 
- <Units>
- <![CDATA[ /uL
  ]]> 
  </Units>
  <Range>0-840</Range> 
  </TestCode>
- <TestCode Ext-ID="46" Status="F" Type="CBCABS">
  <Name>Absolute Eosinophils</Name> 
  <Value>336</Value> 
- <Units>
- <![CDATA[ /uL
  ]]> 
  </Units>
  <Range>0-1200</Range> 
  </TestCode>
- <TestCode Ext-ID="47" Status="F" Type="CBCABS">
  <Name>Absolute Basophils</Name> 
  <Value>84</Value> 
- <Units>
- <![CDATA[ /uL
  ]]> 
  </Units>
  <Range>0-150</Range> 
  </TestCode>
  </UnitCode>
- <UnitCode Ext-ID="1" Status="F" Order-Control-Status="RE">
  <Name>Albumin</Name> 
  <TimeStamp Type="Released Datetime" Value="03/24/2013 07:28 PM" /> 
  <TimeStamp Type="Viewed Datetime" Value="03/24/2013 05:35 PM" /> 
- <TestCode Ext-ID="1001" Status="F">
  <Name>Albumin</Name> 
  <Value>3.1</Value> 
- <Units>
- <![CDATA[ g/dL
  ]]> 
  </Units>
  <Range>2.7-4.4</Range> 
  </TestCode>
- <TestCode Ext-ID="11067" Status="F">
  <Name>Comment</Name> 
  <Value /> 
  <Units /> 
  <Range /> 
- <Comment>
- <![CDATA[ Hemolysis 2+. No significant analyte interference.
  ]]> 
  </Comment>
  </TestCode>
  </UnitCode>
  </Accession>
  </LabReport> 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close