OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   RE: [xml-dev] help XML

[ Lists Home | Date Index | Thread Index ]

Couple of questions...

why is your address infinitely recursive? [can your address really be
composed of an address?{when does it end? - it doesn't - it addresses all
the way to the bottom} ;)]

In your XML, area and city are encoded as attributes... yet your DTD says
they are elements.  I'll assume your XML is correct... but this is why they
don't display for you...

In which case you could try something like this.

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xsl:stylesheet version="1.0"
<xsl:template match="/">
  <body style="font-family:Arial,helvetica,sans-serif;font-size:12pt">
  <h2>My Restaurants Guide</h2>

<xsl:template match="restaurant">

<xsl:template match="name">
  <xsl:value-of select="." />

<xsl:template match="address">
  <br />
  <xsl:value-of select="@str_name" />
  <xsl:text> </xsl:text>
  <xsl:value-of select="@str_number" />
  <xsl:text>, </xsl:text>
  <xsl:value-of select="@area" />
  <xsl:text>, </xsl:text>
  <xsl:value-of select="@city" />

<xsl:template match="kitchen">
  <br />
  <xsl:value-of select="." />

<xsl:template match="payment">
  <br />
  <xsl:value-of select="." />


Note that I modified your stylesheet to employed "push" processing rather
than "pull" processing .. which is tied less strongly to the detailed
structure of your document. I am utilizing rule-base design patterns ..
where the body of the template rule declares which nodes it is interested in
[address, kitchen, payment, etc.]...rather than the template rule for the
parent node defining in detail how its children should be processed.  You
can read about rule based design patterns in detail in Michael Kay's XSLT
Programmers Reference text.


CyberSpace Industries 2000 Inc.
XML Training and Consulting

See our SmartCapital Initiatives at:
http://ato.smartcapital.ca/xml   XML in Ottawa
http://ato.smartcapital.ca/perth Historic Perth Ontario

Visit Historic Perth Ontario at http://www.all-about-perth.com

See my first art exhibit on Mars at http://hugh-chatfield.com

>-----Original Message-----
>From: Binh Thang [mailto:binhthang@hotmail.com]
>Sent: Monday, February 23, 2004 11:45 AM
>To: xml-dev@lists.xml.org
>Subject: [xml-dev] help XML

>Hi everybody,
I am trying to  create a simple xml. This is the way I want to display my
info in html:
Proeverij 272
>Prinsengracht 272, Jordaan, Amsterdam
>I have a DTD, a XML and a XSLT but somehow it doesn't display all the info
(the address info) I >want.
>Many thanx in advance,

  • References:
    • help XML
      • From: "Binh Thang" <binhthang@hotmail.com>


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS