Jump to content


  • Posts

  • Joined

  • Last visited

About ReddetEkim

  • Birthday 02/11/1953

Profile Information

  • Location
    Chicago, IL

ReddetEkim's Achievements


Newbie (1/7)



  1. Actually, none of the subordinate items are appearing. When I added another select for the subordinate items, the original, superior items were no longer displayed. Code is included below. Thanks for any help you can provide. XSL file: <?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/"><html><head><title>Mexican States and Capitals</title><!-- <link rel="stylesheet" type="text/css" href="Test.css" /> --></head><body><h1>Mexican States and Capitals</h1><p id="date"></p><br /><!-- <script type="text/javascript" src="displaydate.js"></script> --><!-- Select State works well--><xsl:for-each select="mexican_states/mexican_state"><p><b>State: </b><xsl:value-of select="state_name"/>(<xsl:value-of select="abbreviation"/>)<br /><b>Capital: </b><xsl:value-of select="state_capital"/><br /><xsl:value-of select="state_notes"/><!-- Select City within State does not work at all--><xsl:for-each select="mexican_states/mexican_state/mexican_city"><b>Cities: </b><xsl:value-of select="city_name"/><xsl:value-of select="city_notes"/></xsl:for-each></p></xsl:for-each><a href="Home_Page.htm">Home Page</a><br /></body></html></xsl:template></xsl:stylesheet> XSD Schema file: <?xml version="1.0" encoding="ISO-8859-1"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="mexican_states"> <xs:complexType> <xs:sequence> <xs:element name="mexican_state" minOccurs="0" maxOccurs="32"> <xs:complexType> <xs:sequence> <xs:element name="state_name" type="xs:string" minOccurs="0" maxOccurs="1" /> <xs:element name="abbreviation" type="xs:string" minOccurs="0" maxOccurs="1" /> <xs:element name="state_capital" type="xs:string" minOccurs="0" maxOccurs="1" /> <xs:element name="state_notes" type="xs:string" minOccurs="0" maxOccurs="1" /> <xs:element name="mexican_city" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="city_name" type="xs:string" minOccurs="0" maxOccurs="1" /> <xs:element name="city_notes" type="xs:string" minOccurs="0" maxOccurs="1" /> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element></xs:schema> XML data file edited for brevity. Multiple states are included in the original file. <?xml version="1.0" encoding="ISO-8859-1"?><?xml-stylesheet type="text/xsl" href="Test.xsl"?><mexican_states xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:noNamespaceSchemaLocation="Test.xsd"><mexican_state><state_name>Jalisco</state_name><abbreviation>Jal</abbreviation><state_capital>Guadalajara*</state_capital><state_notes></state_notes><mexican_city><city_name>Acapulco</city_name><city_notes></city_notes></mexican_city><mexican_city><city_name>Guadalajara</city_name><city_notes></city_notes></mexican_city><mexican_city><city_name>Puerto Vallarta</city_name><city_notes></city_notes></mexican_city></mexican_state></mexican_states>
  2. Hi. After a lot of studying I've learned how to create valid xml schemas and data files, and I've been able to display some of that data on a web page but not all of it. For example, if there are multiple <city> nodes under a <state> node, I've been able to display all of the state nodes in the file using "for-each select" and "value-of select", but only the first city in each state; none of the other cities. How do I display multiple items at a subordinate level like cities in a state? Thanks.
  3. I think one of my problems was a missing </xs:element> since I have two simple elements. But then I got the following error: The following errors were found: TYPE LOC MESSAGE Well Formed 14, 11 The element type "xs:sequence" must be terminated by the matching end-tag "‹/xs:sequence>". I thought I had everything matched up. Sheesh!
  4. Hi. I'm new to XML/Schema. I'm trying to learn a little bit about it for my own information and maybe to incorporate it into a web page. It seems correct to me but almost everything I try ends up with an error. Could someone please tell me what I'm doing wrong? Thanks a lot for any assistance. XML Schema: <?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="[url="http://www.w3.org/2001/XMLSchema"]http://www.w3.org/2001/XMLSchema[/url]"> <xs:element name="root_element"> <xs:complexType> <xs:sequence> <xs:element name="president"> <xs:complexType> <xs:sequence> <xs:element name="first_name" type="xs:string"/> <xs:element name="last_name" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element></xs:schema> XML Data: <?xml version="1.0" encoding="UTF-8"?><root_element xmlns:xsi="[url="http://www.w3.org/2001/XMLSchema-instance"]http://www.w3.org/2001/XMLSchema-instance[/url]"xsi:noNamespaceSchemaLocation="test.xsd"><root_element><president><first_name>George</first_name><last_name>Washington</last_name></president><president><first_name>John</first_name><last_name>Adams</last_name></president></root_element> Errors without <root_element> in xml file:The following errors were found: TYPE LOC MESSAGE Validation 8, 12 cvc-complex-type.2.4.d: Invalid content was found starting with element 'president'. No child element is expected at this point. Well Formed 11, 13 XML document structures must start and end within the same entity. Errors with <root_element> in XML file:The following errors were found: TYPE LOC MESSAGE Validation 4, 15 cvc-complex-type.2.4.a: Invalid content was found starting with element 'root_element'. One of '{president}' is expected. Validation 9, 12 cvc-complex-type.2.4.d: Invalid content was found starting with element 'president'. No child element is expected at this point. Well Formed 13, 16 XML document structures must start and end within the same entity.
  • Create New...