Figures
Figure 1 xmlDVD
<XML ID="xmlDVD">
  <?xml version="1.0" encoding="UTF-8" ?>
 <METADATA xmlns:sql='urn:schemas-microsoft-com:xml-sql'>
    <MOVIE>
      <version>4.0</version>
        <movieTitle>As Good As It Gets</movieTitle>
         <titleInfo>
           <titleNum>1</titleNum>
            <titleTitle>As Good As It Gets</titleTitle>
            <studio>Columbia TriStar Home Video</studio>
            <director>James L. Brooks</director>
            <leadPerformer>Jack Nicholson</leadPerformer>
            <chapter>
            <chapterNum>0</chapterNum>
        <chapterTitle>Start [5:46]</chapterTitle>
        </chapter>
    </titleInfo>
</MOVIE>
</METADATA>                          
</XML>
This is the data Title from the our xml<BR>
<table border=2 bordercolor=red datasrc="#xmlDVD">
  <tr>
     <td><span datafld="movieTitle"></span></td>
     <td><span datafld="studio"></span></td>
     <td><span datafld="leadPerformer"></span></td>
     </tr>
</table>
Figure 2 XML Data Island
<table style="table-layout:fixed" datasrc="#xmlDVD" datafld="chapter">
<tr>
  <td valign="top" align="left" width="80"><input type="hidden" 
    name="txtChapterNum" datafld="chapterNum">
      <span dir="<%=g_oDVDWizard.strDirection%>" class="texts-b"
      datafld="chapterNum">
      </span>
      <span dir="<%=g_oDVDWizard.strDirection%>" class="texts-b" >:
      </span>
  </td>
  <td valign="top" align="left" width="200"><input type="text" 
    name="txtChapter"
    id="txtChapter" datafld="chapterTitle" size="30"
    onKeyUp="EnableNext('<%=MODE%>');"> 
  </td>
  <td width="10"><img src="/dvdwizard/images/ts.gif" alt="" width="10">
  </td>
  <td valign="top" align="left" width="80">
    <input type="button" name="btnInsert" id="btnInsert" value="Insert"  
    class="smallbtn" 
    onclick="insertRow(this, 'insert', 'edit')" >
  </td>
  <td valign="top" align="left" width="80">
    <input type="button" name="btnDelete" id="btnDelete" value="Delete" 
       class="smallbtn" >
  </td>
</tr>
</table>
Figure 3 Posting an Updategram
<table>
<tr><td>
<table cellSpacing="1" cellPadding="1" width="500" border="0" id="TABLE1" 
  bgcolor="lightgrey" title rules="none">
<form action="http://localhost/Project/" method="post" id="form1"   
  name="form1">
  <tbody>
  <tr>
    <td colspan="2" bgcolor="#000080"> Add Client </td>
  </tr>
  <tr>
    <td width="100">Client: </td>
    <td><input id="ClientName" name="ClientName" size="30"></td></tr>
  <tr>
    <td>Address Line 1: </td>
    <td><input id="AddressLine1" size="61" name="AddressLine1"    
    maxLength="50"></td></tr>
  <tr>
    <td>Phone: </td>
    <td><input id="Phone" size="30" name="Phone" maxLength="30"></td>
  </tr>
  <tr>
    <td>Fax: </td>
    <td><input id="Fax" size="30" name="Fax" maxLength="30">
        <input type=hidden name=contenttype value=text/xml>
        <input type=hidden name=template value=" ">
        <ROOT xmlns:updg="urn:schemas-microsoft-com:xml-updategram" >
          <updg:header>
            <updg:param name="ClientName" />
            <updg:param name="AddressLine1" />
          </updg:header>
          <updg:sync >
            <updg:before>
            </updg:before>
            <updg:after updg:returnid="ClientID AddrID" >
              <Address updg:at-identity="AddrID" 
                       AddressLine1="$AddressLine1" 
                       AddressLine2="$AddressLine2" 
                       City="$City" 
                       State="$State" 
                       ZipCode="$ZipCode" />
              <Client  updg:at-identity="ClientID"
                       ClientName="$ClientName" 
                       AddressID="AddrID"/>
            </updg:after>
          </updg:sync>
        </ROOT>'>
    </td>
  </tr>
  <tr>
    <td colspan="2" align="right"><input type="submit" value="OK"   
      id="submit1" name="submit1" size="50" style="WIDTH: 70px; 
      HEIGHT: 24px" CHECKED>&nbsp;<input type="reset" value="Cancel" 
      id="reset1" name="reset1" size="50" style="WIDTH: 70px"></td>
  </tr>
•••
Figure 4 Using XSL
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  version="1.0">
   <xsl:template match="/">
      <html>
         <body>
            <xsl:choose>
               <xsl:when test="boolean(ROOT/processing-
                 instruction('MSSQLError'))">
                  <B>There was an error:</B><BR/>
                  <xsl:apply-templates select="ROOT/processing-
                    instruction('MSSQLError')" /> 
               </xsl:when>
               <xsl:otherwise>
                 <xsl:apply-templates select="ROOT/returnid" /> 
               </xsl:otherwise>
            </xsl:choose>  
            <P>
               <a href="/ProjectDB/AddClient.asp">Add another client
               </a><BR/>
               <a href="/ProjectDB/default.asp">Return home</a><BR/>
            </P>   
         </body>
      </html>
   </xsl:template>
 
   <xsl:template match="processing-instruction('MSSQLError')">
      ERROR:
      <xsl:value-of select="substring-after(., 'Description=')"/><BR/>
   </xsl:template>
   <xsl:template match="returnid">
      Client ID = <xsl:value-of select="ClientID"/><BR/>
      Address ID = <xsl:value-of select="AddrID"/><BR/>
   </xsl:template>
</xsl:stylesheet>

Home
Current Issue
Topics
Issues
Columns
Downloads
Subscribe
Contact Us

MSDN Magazine