|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I've been supplied with the following XML file and am wanting to display the data in a HTML table. The XML file has been generated by Crystal Reports. Previously i've beeen able to call XML(more basic looking XML files) into HTML using the <span datafld="____"></span> command.. But i've tried it with this particular XML file and no luck at all. I've tried putting everything in the "datafld" area and no luck. Could someone please provide info on how to call data from the following file into a HTML table. Any help would be greatly apreciated. Thanks for your time
Heres an extract of my XML file <?xml version="1.0" encoding="UTF-8" ?> <FormattedReport xmlns = 'urn:crystal-reports:schemas' xmlns:xsi = 'http://www.w3.org/2000/10/XMLSchema-instance'> <FormattedAreaPair Level="0" Type="Report"> <FormattedAreaPair Level="1" Type="Group"> <FormattedArea Type="Header"> <FormattedSections> <FormattedSection SectionNumber="0"> <FormattedReportObjects> <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" FieldName="GroupName ({VhStock.MAKE})"><ObjectName>Field26</ObjectName> <FormattedValue>DAEWOO</FormattedValue> <Value>DAEWOO</Value> </FormattedReportObject> </FormattedReportObjects> </FormattedSection> </FormattedSections> </FormattedArea> <FormattedAreaPair Level="2" Type="Group"> <FormattedAreaPair Level="3" Type="Details"> <FormattedArea Type="Details"> <FormattedSections> <FormattedSection SectionNumber="0"> <FormattedReportObjects> <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" FieldName="{VhStock.REGNO}"><ObjectName>Field22</ObjectName> <FormattedValue>RLF462</FormattedValue> <Value>RLF462</Value> </FormattedReportObject> <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" FieldName="{VhStock.BODY_TYPE}"><ObjectName>Field25</ObjectName> <FormattedValue>SEDAN</FormattedValue> <Value>SEDAN</Value> </FormattedReportObject> <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" FieldName="{VhStock.TRANSMISSION}"><ObjectName>Field27</ObjectName> <FormattedValue>5M</FormattedValue> <Value>5M</Value> </FormattedReportObject> <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" FieldName="{VhStock.PAINT}"><ObjectName>Field28</ObjectName> <FormattedValue>GREEN</FormattedValue> <Value>GREEN</Value> </FormattedReportObject> <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:timeInstant" FieldName="{VhStock.compliance_date}"><ObjectName>Field29</ObjectName> <FormattedValue>06/98</FormattedValue> <Value>1998-06-01T00:00:00</Value> </FormattedReportObject> <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:timeInstant" FieldName="{VhStock.REGEXP}"><ObjectName>Field30</ObjectName> <FormattedValue>4/02/05</FormattedValue> <Value>2005-02-04T00:00:00</Value> </FormattedReportObject> <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:decimal" FieldName="{VhStock.ODOMETER}"><ObjectName>Field31</ObjectName> <FormattedValue>87,136</FormattedValue> <Value>87136.00</Value> </FormattedReportObject> <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" FieldName="{VhStock.BR}"><ObjectName>Field33</ObjectName> <FormattedValue>B</FormattedValue> <Value>B</Value> </FormattedReportObject> <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:decimal" FieldName="{@DIS}"><ObjectName>Field34</ObjectName> <FormattedValue>269</FormattedValue> <Value>269.00</Value> </FormattedReportObject> <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:decimal" FieldName="{VhStock.veh_sale_price_inc_gst}"><ObjectName>Field1</ObjectName> <FormattedValue>$7,995</FormattedValue> <Value>7995.00</Value> </FormattedReportObject> <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:long" FieldName="{VhStock.NO}"><ObjectName>Field2</ObjectName> <FormattedValue>110</FormattedValue> <Value>110.00</Value> </FormattedReportObject> <FormattedReportObject xsi:type="CTFormattedField" FieldName="{@Model & Level}" Type="xsd:string"><ObjectName>Field5</ObjectName> <FormattedValue>LANOS SE</FormattedValue> <Value>LANOS SE</Value> </FormattedReportObject> <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" FieldName="{VhStock.MODEL}"><ObjectName>Field6</ObjectName> <FormattedValue>D4L</FormattedValue> <Value>D4L</Value> </FormattedReportObject> <FormattedReportObject xsi:type="CTFormattedField" Type="xsd:string" FieldName="{VhStock.note}"><ObjectName>Field3</ObjectName> <FormattedValue>ONE LOCAL OWNER, FULL SERVICE HISTORY, AIR CONDITIONING, POWER STEERING.</FormattedValue> <Value>ONE LOCAL OWNER, FULL SERVICE HISTORY, AIR CONDITIONING, POWER STEERING.</Value> </FormattedReportObject> </FormattedReportObjects> </FormattedSection> </FormattedSections> </FormattedArea> </FormattedAreaPair> </FormattedAreaPair> </FormattedAreaPair> |
|
#2
|
|||
|
|||
|
I won't do the whole stuff, but with three xsl templates, you can already take care of the html table (i'll leave the rest up to you):
Code:
<xsl:template match="FormattedReportObjects">
<table brder="0">
<xsl:apply-templates />
<table>
</xsl:template>
<xsl:template match="FormattedReportObject">
<tr>
<xsl:apply-templates />
</tr>
</xsl:template>
<xsl:template match="ObjectName | FormattedValue | Value">
<td>
<xsl:value-of select="text()" />
</td>
</xsl:template>
This will take care of the data that you have to put into a table, for the rest, find some xsl tutorial around (w3schools), and built the page around it. Hope this helps ![]() |
|
#3
|
|||
|
|||
|
Thank You very much
Thanks a lot.. much appreciated, that should help me plenty.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > How to process this XML file in HTML |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|