RE: [xsl] Passing XML data to HTML form

Subject: RE: [xsl] Passing XML data to HTML form
From: "SHEIKH Sajjad" <Sajjad.SHEIKH@xxxxxxxxxxx>
Date: Mon, 1 Dec 2003 16:01:55 +0100
Thanks David for responding.  Please find below all the required codes
and required results' description.  
Hope it will highlight well, the issue I am having.

1.xsl, displays a link "Order it Now" when
category/attributeset/attribute[@attid=2]='Unrestricted'
This link goes to a html form (I prefer xml form!).
{
          <xsl:when
test="category/attributeset/attribute[@attid=2]='Unrestricted'">
           <a href="c:\1xml\request_form.xml">Order It Now!</a>
}

Required OutPut
---------------

1) I want to display a prefilled form when user clicks on "Order It
Now!".  Display will show the values of attributes "ObjId", "name" and
"description".
2) There will be few input fields as well like Requestor's Name, Email
address etc which will be entered manually by requestor.


------------------------------------------------ 1.xsl
---------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
<xsl:output method="html" version="1.0" encoding="iso-8859-1"
indent="yes"/>

 <xsl:template match="/">
  <html>
    <head><title> EU Registry </title></head>
   <body>
    <h2>EU Registry</h2>
    <table border="1">
     <tr bgcolor="#9acd32">
      <th align="left">Document Name</th>
      <th align="left">Document Title</th>
      <th align="left">Documents' Identifier</th>
      <th align="left">Short Description</th>
      <th align="left">Date Received</th>
      <th align="left">Classification</th>
      <th align="left">Scope</th>
      <th align="left">Availability</th>

     </tr>
      
     <xsl:for-each select="livelink//llnode">

<!-- Sort the documents with documents' identifier -->
	<xsl:sort
select="category/attributeset/attribute[@name='Question Number']"/>
      <tr>

<!-- If document is found then process it as following -->
       <xsl:if test="@objname='Document'">

<!-- Verify the document extension with its mime type -->
        <td><xsl:value-of select="substring-after(@mimetype,'/')"/></td>

<!-- Get the document title without its extension -->
        <td>
         <xsl:choose>
          <xsl:when test="contains(@name,'.')">
           <xsl:value-of select="substring-before(@name,'.')"/>
          </xsl:when>
          <xsl:when test="contains(@name,'.')=false">
           <xsl:value-of select="@name"/>
          </xsl:when>
         </xsl:choose></td>


<!-- Get the document identifier -->
        <td width="14%"><xsl:value-of
select="category/attributeset/attribute[@name='Question Number']"/></td>

<!-- Get the document short description -->
         <td>
	 <xsl:choose>
          <xsl:when test="@description">
           <xsl:value-of select="@description"/>
          </xsl:when>
	  <xsl:otherwise> 	
           Not Available
	  </xsl:otherwise>	
         </xsl:choose>
	 </td>

<!-- Get the document recieved date -->
           <td><xsl:value-of
select="substring-before(@created,'T')"/></td>

<!-- Get the document classification -->
           <td><xsl:value-of
select="category/attributeset/attribute[@attid=2]"/></td>


        <td><xsl:value-of
select="category/attributeset/attribute[@attid=3]"/></td>
        <td>
         <xsl:choose>
          <xsl:when
test="category/attributeset/attribute[@attid=2]='Restricted'">
           <a href="mailto:admin@xxxxxxxxxxx";>More Info!</a>
          </xsl:when>
          <xsl:when
test="category/attributeset/attribute[@attid=2]='Confidential'">
           <a href="mailto:admin@xxxxxxxxxxx";>More Info!</a>
          </xsl:when>
          <xsl:when
test="category/attributeset/attribute[@attid=2]='Unrestricted'">
           <a href="c:\1xml\request_form.xml">Order It Now!</a>
          </xsl:when>
         </xsl:choose></td>
       </xsl:if>
      </tr>
</xsl:for-each>
    </table>
   </body>
  </html>
 </xsl:template>
</xsl:stylesheet>


------------------------------------------------ 1.xml
---------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="1.xsl"?>

<livelink applanguage='USA' appversion='9.1.0' dtdversion='1.2'>
  <llnode created='2003-10-20T19:21:40' createdby='158210'
createdbyname='Sheikh, Sajjad' id='171944'
modified='2003-10-21T09:41:10' name='Question Folder' objname='Folder'
objtype='0' ownedby='158210' ownedbyname='Sheikh, Sajjad'
parentid='3866' size='4'>
    <category defid='171842' name='Question Numbers' versionid='1'>
      <attributeset attid='1' name='Question Numbers'>
        <attribute attid='2' name='Question Number' type='-1'/>
      </attributeset>
    </category>
    <llnode created='2003-10-21T09:41:10' createdby='158210'
createdbyname='Sheikh, Sajjad' description='This is about environmental
safety NK603.' id='171726' mimetype='application/msword'
modified='2003-10-21T09:41:10' name='GM maize NK603 environmental safety
(2001/18)' objname='Document' objtype='144' ownedby='158210'
ownedbyname='Sheikh, Sajjad' parentid='171944' size='36352'
versionnum='1'>
      <category defid='37402' name='Security Data (EFSA)' versionid='3'>
        <attributeset attid='1' name='Security Data (EFSA)'>
          <attribute attid='2' name='Classification Level'
type='10'>Confidential</attribute>
          <attribute attid='3' name='Scope of Dissemination'
type='10'>Panel</attribute>
        </attributeset>
      </category>
      <category defid='171842' name='Question Numbers' versionid='1'>
        <attributeset attid='1' name='Question Numbers'>
          <attribute attid='2' name='Question Number'
type='-1'>EFSA-Q-2003-003</attribute>
        </attributeset>
      </category>
    </llnode>
    <llnode created='2003-10-20T19:27:36' createdby='158210'
createdbyname='Sheikh, Sajjad' id='171842'
modified='2003-10-20T19:29:45' name='Question Numbers'
objname='Category' objtype='131' ownedby='158210' ownedbyname='Sheikh,
Sajjad' parentid='171944' size='419' versionnum='1'>
    </llnode>
    <llnode created='2003-10-20T19:31:39' createdby='158210'
createdbyname='Sheikh, Sajjad' id='171945' mimetype='application/pdf'
modified='2003-10-21T09:34:32' name='Austrian notification of national
legislation governing GMOs under Article 95(5) of the Treaty'
objname='Document' objtype='144' ownedby='158210' ownedbyname='Sheikh,
Sajjad' parentid='171944' size='408564' versionnum='1'>
      <category defid='37402' name='Security Data (EFSA)' versionid='3'>
        <attributeset attid='1' name='Security Data (EFSA)'>
          <attribute attid='2' name='Classification Level'
type='10'>Unrestricted</attribute>
          <attribute attid='3' name='Scope of Dissemination'
type='10'>World (no limitation)</attribute>
        </attributeset>
      </category>
      <category defid='171842' name='Question Numbers' versionid='1'>
        <attributeset attid='1' name='Question Numbers'>
          <attribute attid='2' name='Question Number'
type='-1'>EFSA-Q-2003-001</attribute>
        </attributeset>
      </category>
    </llnode>
    <llnode created='2003-10-21T09:39:18' createdby='158210'
createdbyname='Sheikh, Sajjad' description='This is about food safety.'
id='171952' mimetype='application/vnd.ms-powerpoint'
modified='2003-10-21T09:39:18' name='GM maize NK603 food safety
(258/97)' objname='Document' objtype='144' ownedby='158210'
ownedbyname='Sheikh, Sajjad' parentid='171944' size='241664'
versionnum='1'>
      <category defid='37402' name='Security Data (EFSA)' versionid='3'>
        <attributeset attid='1' name='Security Data (EFSA)'>
          <attribute attid='2' name='Classification Level'
type='10'>Restricted</attribute>
          <attribute attid='3' name='Scope of Dissemination'
type='10'>EFSA</attribute>
        </attributeset>
      </category>
      <category defid='171842' name='Question Numbers' versionid='1'>
        <attributeset attid='1' name='Question Numbers'>
          <attribute attid='2' name='Question Number'
type='-1'>EFSA-Q-2003-002</attribute>
        </attributeset>
      </category>
    </llnode>
  </llnode>
</livelink>


-----Original Message-----
From: David Carlisle [mailto:davidc@xxxxxxxxx] 
Sent: 01 December 2003 15:29
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Passing XML data to HTML form




> I want to pass those values to a html form so it will be a prefilled 
> form.

> I have no idea, if I can do that with xslt.

XSLT doesn't know anything about html or any specific xml language, it
just transforms a tree of input elements to a tree of output elements.

Your posting had a bit of html including a form element and part of an
xsl stylesheet, but it wasn't at all clear what the input of your
transformation is, what you want the output to be, or what
transformation you are trying to perform.

You've been on the list long enough to know the rules:
post small complete input xml document and small complete required
output, with some overall description of the required transformation,
then you have a chance that someone could offer some help.


David
-- 
http://www.dcarlisle.demon.co.uk/matthew

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


______________________________________________________________
This message has been scanned for all viruses by BTnet VirusScreen. The
service is delivered in partnership with MessageLabs.

This service does not scan any password protected or encrypted
attachments.  

If you are interested in finding out more about the service, please
visit our website at
http://www.btignite.com/internetservices/btnet/products_virusscreen.htm
==============================================================

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread