× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



hi there,

I have a webpage which uses an xml-data file to display all records.  Is 
it
possible to make a subselection to display only a part of the XML-data 
file?

In the included example i want to display records which have a value of 
'E'
for field 'iestatus' only.

this is the example:
=========
HTMLFILE
=========
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
 <title>Sailing List</title>
<META name="GENERATOR" content="Microsoft FrontPage 4.0">
</head>

<body>
 <xml id="dsoSailing" src="sailings.xml"></xml>

 <h2>Sailing Liner Schedule</h2>

    <table>

  <tr>
    <td width="768" height="25" colspan="16">
 <xml id="dsoSailing" src="sailingsStar.xml"></xml>
 <table width="768" align="center" datasrc="#dsoSailing" border="1">
  <thead>
   <th align="left">Vessel Name</th>
   <th align="center">I/E</th>
   <th align="center">Date</th>
   <th align="left">Status</th>
   <th align="left">Port</th>
  </thead>
  <tr align="center">
            <td width="223" align="left" style="font-family: Verdana;
font-size: 7pt"><SPAN datafld="vesselname"></SPAN></FONT></td>
            <td width="25" align="center" style="font-family: Verdana;
font-size: 7pt"><SPAN datafld="iestatus"></SPAN></FONT></td>
            <td width="70" align="center" style="font-family: Verdana;
font-size: 7pt"><SPAN datafld="date"></SPAN></FONT></td>
            <td width="50" align="left" style="font-family: Verdana;
font-size: 7pt"><SPAN datafld="vesselstatus"></SPAN></FONT></td>
            <td width="400" align="left" style="font-family: Verdana;
font-size: 7pt"><SPAN datafld="ports"></SPAN></FONT></td>
        </tr>
 </table>
 </td>
  </tr>

</body>

=========
XML FILE
=========
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="sailings.xsl"?>
<schedule>
   <sailing>
      <linename>STAR - US PACIFIC</linename>
      <iestatus>I</iestatus>
      <vesselname>STAR HOYANGER BC315</vesselname>
      <date>10-09-2003</date>
      <vesselstatus>SAILED</vesselstatus>
      <ports>.</ports>
   </sailing>
   <sailing>
      <linename>STAR - US PACIFIC</linename>
      <iestatus>E</iestatus>
      <vesselname>STAR GRIP USWC1703</vesselname>
      <date>15-09-2003</date>
      <vesselstatus>EXPECTED</vesselstatus>
      <ports>.</ports>
   </sailing>
   <sailing>
      <linename>STAR - FCL</linename>
      <iestatus>I</iestatus>
      <vesselname>STAR HOYANGER BC315</vesselname>
      <date>10-09-2003</date>
      <vesselstatus>SAILED</vesselstatus>
      <ports>.</ports>
   </sailing>
   <sailing>
      <linename>STAR - FCL</linename>
      <iestatus>E</iestatus>
      <vesselname>STAR GRIP US317</vesselname>
      <date>15-09-2003</date>
      <vesselstatus>EXPECTED</vesselstatus>
      <ports>.</ports>
   </sailing>
   <sailing>
      <linename>STAR - US PACIFIC</linename>
      <iestatus>I</iestatus>
      <vesselname>STAR DROTTANGER BC316</vesselname>
      <date>22-09-2003</date>
      <vesselstatus>EXPECTED</vesselstatus>
      <ports>From: OAKLAND, CA</ports>
   </sailing>
   <sailing>
      <linename>STAR - FCL</linename>
      <iestatus>I</iestatus>
      <vesselname>STAR DROTTANGER BC316</vesselname>
      <date>25-09-2003</date>
      <vesselstatus>EXPECTED</vesselstatus>
      <ports>From: OAKLAND, CA</ports>
   </sailing>
   <sailing>
      <linename>STAR - FCL</linename>
      <iestatus>E</iestatus>
      <vesselname>STAR HOYANGER US318</vesselname>
      <date>24-09-2003</date>
      <vesselstatus>EXPECTED</vesselstatus>
      <ports>To: LOS ANGELES, CA - OAKLAND, CA</ports>
   </sailing>
   <sailing>
      <linename>STAR - US PACIFIC</linename>
      <iestatus>E</iestatus>
      <vesselname>STAR HOYANGER USWC1803</vesselname>
      <date>23-09-2003</date>
      <vesselstatus>EXPECTED</vesselstatus>
      <ports>To: LOS ANGELES, CA - SAN FRANCISCO, CA - VANCOUVER, WA -
PORTLAND, OR - VANCOUVER, BC - NEW WESTMINSTER, BC</ports>
   </sailing>
</schedule>

========
XSL FILE
========
<!-- Vessel Schedules -->
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">

 <xsl:template match="/schedule">
  <html>
  <header></header>
  <body>
  <table>
   <tr>
    <th align="center">Line Name</th><th align="center">Status</th><th
align="center">Vessel Name</th><th align="center">Date</th><th
align="center">Vessel Status</th><th align="center">Ports</th>
   </tr>
   <xsl:apply-templates select="sailing" />
  </table>
  </body>
  </html>
 </xsl:template>

 <xsl:template match="sailing">
  <tr>
   <td align="left"><xsl:apply-templates select="linename" /></td>
   <td align="left"><xsl:apply-templates select="iestatus" /></td>
   <td align="left"><xsl:apply-templates select="vesselname" /></td>
   <td align="left"><xsl:apply-templates select="date" /></td>
   <td align="left"><xsl:apply-templates select="vesselstatus" /></td>
   <td align="left"><xsl:apply-templates select="ports" /></td>
  </tr>
 </xsl:template>

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

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

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

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

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

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

</xsl:stylesheet>



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.