To run the application you must create the following files:
To create the sample XML file
invoices.xml
<?xml version="1.0"?> <!DOCTYPE invoices [ <!ELEMENT invoices (invoice)*> <!ELEMENT invoice ( patient, insurance?, procedure* )> <!ATTLIST invoice number CDATA #REQUIRED date CDATA #REQUIRED> <!ELEMENT patient ( phone | address )*> <!ATTLIST patient firstname CDATA #REQUIRED familyname CDATA #REQUIRED SSN CDATA ""> <!ELEMENT insurance ( address | phone )*> <!ATTLIST insurance name CDATA "" plannumber CDATA "" planname CDATA ""> <!ELEMENT procedure (#PCDATA) > <!ATTLIST procedure code CDATA #REQUIRED name CDATA "" cost CDATA "" insurance_estimate CDATA "" submitted (yes|no) "yes"> <!ELEMENT phone EMPTY> <!ATTLIST phone type (home|work|mobile|other) "other" number CDATA ""> <!ELEMENT address EMPTY> <!ATTLIST address type (home|work|business|other) "other" company CDATA "" line1 CDATA "" line2 CDATA "" city CDATA "" state CDATA "" zip CDATA ""> ]> <invoices> <invoice number="25" date="February 28, 2001"> <patient firstname="Jeff" familyname="Smith" SSN="123456789"> <phone type="home" number="123-4567890"/> <phone number="321-76543321" type="work"/> <address type="home" line1="123 Street" city="City" state="US" zip="12345"/> </patient> <insurance name="Humongous First Medical Insurance" plannumber="12345" planname="The Client Company"> <phone number="098-76543321"/> <address type="business" line1="321 Street" city="City" state="US" zip="54321"/> </insurance> <procedure code="123" name="Cleaning nose" cost="50.00" insurance_estimate="50.00"/> <procedure code="124" name="Tarot reading of illnesses" cost="150.00" insurance_estimate="120.00"/> <procedure code="125" name="Just for fun" cost="100.00" insurance_estimate="80.00"/> </invoice> <invoice number="27" date="February 28, 2001"> <patient firstname="James" familyname="Smith" SSN="123456765"> <phone type="home" number="123-4562245"/> <address type="home" line1="432 Street" city="City" state="US" zip="12343"/> </patient> <insurance name="Humongous Second Medical Insurance" plannumber="3455" planname="Another Client Company"> <phone number="098-76543321"/> <address type="business" line1="344 Street" city="Some City" state="US" zip="54323"/> </insurance> <procedure code="123" name="Cleaning nose" cost="50.00" insurance_estimate="50.00"/> <procedure code="124" name="Tarot reading of illnesses" cost="150.00" insurance_estimate="120.00"/> </invoice> <invoice number="29" date="February 28, 2001"> <patient firstname="Neil" familyname="Smith" SSN="123456345"> <phone type="home" number="125-4345890"/> <address type="home" line1="187 Street" city="Lost City" state="US" zip="42145"/> </patient> <insurance name="Humongous Third Medical Insurance" plannumber="12345" planname="The Lost City Client Company"> <phone number="198-76345321"/> <address type="business" line1="342 Street" city="Completely Lost City" state="US" zip="111111-0000"/> </insurance> <procedure code="123" name="Cleaning nose" cost="50.00" insurance_estimate="50.00"/> <procedure code="125" name="Maybe they wouldn't see this line..." cost="100.00" insurance_estimate="80.00"/> </invoice> </invoices>
To create the sample XSLT file
invoices.xsl
<?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html"/> <xsl:template match="/"> <HTML> <BODY bgcolor="#FFFFE0"> <TABLE border="0" width="100%"><TR><TD> <H1>Invoice # <xsl:value-of select="invoice/@number"/>,<BR/> <xsl:value-of select="invoice/@date"/> </H1> </TD><TD align="right"><img src="sax_extractData_logo.gif"/> </TD></TR></TABLE> <TABLE border="0" width="100%"> <TR valign="top"> <TD> <xsl:for-each select="/invoice/patient"> To: <xsl:value-of select="@firstname"/><xsl:text> </xsl:text> <xsl:value-of select="@familyname"/> <BR/>Account #<xsl:value-of select="@SSN"/> <BR/> <xsl:value-of select="address/@line1"/><BR/> <xsl:if test="address/@line2!=''"> <xsl:value-of select="address/@line2"/><BR/> </xsl:if> <xsl:value-of select="address/@city"/>, <xsl:value-of select="address/@state"/> <xsl:value-of select="address/@zip"/><BR/> </xsl:for-each> </TD> <TD> <xsl:for-each select="/invoice/insurance"> Insurance: <xsl:value-of select="@name"/><BR/> Plan name: <xsl:value-of select="@planname"/><BR/> Plan #<xsl:value-of select="@plannumber"/><BR/> <xsl:value-of select="address/@line1"/><BR/> <xsl:if test="address/@line2!=''"> <xsl:value-of select="address/@line2"/><BR/> </xsl:if> <xsl:value-of select="address/@city"/>, <xsl:value-of select="address/@state"/> <xsl:value-of select="address/@zip"/><BR/> <xsl:value-of select="phone/@number"/><BR/> </xsl:for-each> </TD> </TR> </TABLE> <P> </P> <TABLE border="1" width="100%"> <TR> <TD width="20%">Code</TD> <TD width="20%">Name</TD> <TD width="20%">Cost</TD> <TD width="20%">Insurance estimate</TD> <TD width="20%">Submitted</TD> </TR> <xsl:for-each select="/invoice/procedure"> <TR> <TD width="20%"><xsl:value-of select="@code"/></TD> <TD width="20%"><xsl:value-of select="@name"/></TD> <TD width="20%"><xsl:value-of select="@cost"/></TD> <TD width="20%"><xsl:value-of select="@insurance_estimate"/></TD> <TD width="20%"><xsl:value-of select="@submitted"/></TD> </TR> </xsl:for-each> </TABLE> <P> </P> </BODY> </HTML> </xsl:template> </xsl:stylesheet>
To create the GIF logo art file
Extract Data From a Large Document | Overview of the XML Extractor Application | Application Forms (XML Extractor) | MyExtractor Class (XML Extractor) | Run the Application (XML Extractor) | How the XML Extractor Application Works