Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 15th, 2004, 08:34 AM
Authorized User
 
Join Date: Jul 2003
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Default XML Parser Problem??

I've tried to run these allot and it only shows me a XML document. I want it to actually run the little test that comes back with the first occurrence of company. Could someone please tell me what I'm doing wrong? I'm using IE6.

STYLE SHEET
Code:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match = "/">
<html>
<head>
<title>Sample XSLT StyleSheet</title>
</head>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>

<xsl:template match="company">
<p>Company Encountered</p>
</xsl:template>
</xsl:stylesheet>
XML FILE
Code:
<?xml version="1.0"?>
<?xsl-stylesheet version="1.0" type = "simple/xsl" href ="SampleStyleSheet.xsl"?>

<!-- initial xml definition for taxonony 
 created on 08/02/04 -->

<company>
<!-- company specific attributes  
if the company supports sub-entities, such as MGA's or other companies under a     parent, then each sub-entity should be enumerated
with coding to support selection of specific company sub-entity
-->
    <companycode>498</companycode>
    <companyname>Aries Insurance Company</companyname>
    <status>
        <cycle>Rehab</cycle>
        <cycledate>05/09/2002</cycledate>
        <cycle>Liquidate</cycle>
        <cycledate>11/14/2002</cycledate>
    </status>

<policy>

    <policynumber>GLO07234567</policynumber>
    <effectdate>09/14/2003</effectdate>
    <expiredate>09/14/2004</expiredate>
    <insured>
        <lastname>Pemo</lastname>
        <firstname>Bryson</firstname>
        <midlname>W</midlname>
    </insured>
<claim>
<!-- claim specific data is enumerated here..
each & every company claim against the above policy would be enumerated here
if the policy had no claims against it, the tag would be empty
-->
    <type>LC</type>
    <lossdate>08/02/2004</lossdate>
    <claimnumber>20040567</claimnumber>
    <claimant>

        <claimantnumber>00001</claimantnumber>
        <lastname>Elvis</lastname>
        <firstname>Presely</firstname>
        <midlname>A</midlname>
    </claimant>
    <type>RP</type>
    <lossdate>11/14/2004</lossdate>
    <claimnumber></claimnumber>
    <claimant>
        <claimantnumber>00001</claimantnumber>
        <lastname>John</lastname>
        <firstname>Lennon</firstname>
        <midlname>W</midlname>
    </claimant>

</claim>
</policy>
</company>
 
Old September 15th, 2004, 09:23 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Your processing instruction is incorrect, it should be
Code:
<?xml-stylesheet type="text/xsl" href="SampleStyleSheet.xsl" ?>
.
Of course this stylesheet won't use any of the values in the document, you could change the company template to:
Code:
<xsl:template match="company">
<p><xsl:value-of select="companyname"/></p>
</xsl:template>
to see some data.



--

Joe (Co-author Beginning XML, 3rd edition)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Xml parser testing Manoah XML 1 July 11th, 2008 04:10 AM
XML Parser alfatat SQL Language 0 March 29th, 2006 11:20 AM
How to write XML parser using JAVA inderjeet_79 BOOK: Professional Jakarta Struts 0 August 12th, 2005 12:37 AM
XML Parser problems stephen_c_ Beginning PHP 0 July 11th, 2005 09:40 PM
PHP4 XML parser question rburke_36 All Other Wrox Books 1 January 12th, 2004 04:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.