[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

1 stylesheet for many xml templates

Subject: 1 stylesheet for many xml templates
From: Jo Bourne <venus@xxxxxxxxx>
Date: Tue, 6 Feb 2001 21:04:45 +1100
xml templates
Hi,

my cgi produces an xml file for each record in each table of our database. The structure of these xml files is the same regardless of what table the item is in, but some of the element names are different or have different attribute values:

<page TABLENAME="foo">
<edit>
[... different elements here ...]
<the_item TABLENAME="foo">
[... elements in here have different names..]
</the_item>
[... different elements here ...]
</edit>
</page>

for each record there are actually a number of pages (1 to display, 1 to edit, etc). I have found a way that I am happy with to make a single xsl file that can handle all the records in all the tables for the display pages. However, I am really struggling with the edit pages.

I just can't figure out how to put the form element in to the edit page so that the url is correct for each table.

<form method="post" action="http://mydomain.com/my.cgi?update_TABLENAME">

My entire stylesheet is below. I would be most grateful for any suggestions.

cheers
Jo

<?xml version="1.0"?>


<!-- start chunk = xsl_declarations --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- end chunk = xsl_declarations -->

<xsl:key name="field_titles" match="//field_titles/*" use="name()" />

<xsl:template match="page">
<HTML>
<HEAD>
<TITLE>VCE Test Generic</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#cc0000" VLINK="#00bb00">
<xsl:apply-templates select="*/the_item"/>
</BODY>
</HTML>
</xsl:template>


<xsl:template match="the_item">
<CENTER>
<form method="post" action="http://mydomain.com/my.cgi?update_TABLENAME">
<xsl:for-each select="*[@type='input_hidden']">
<xsl:copy-of select="./*|./text()"/>
</xsl:for-each>
<TABLE BORDER="0" WIDTH="500" CELLPADDING="0" CELLSPACING="10">
<TR>
<TD COLSPAN="2" ALIGN="CENTER"><PRE><IMG SRC="resources/header.jpg" WIDTH="80" HEIGHT="111" BORDER="0" /><IMG SRC="resources/header_generic.gif" WIDTH="349" HEIGHT="111" BORDER="0" /></PRE></TD>
</TR>
<xsl:for-each select="*[@type!='input_hidden' and @type!='buttons']">
<TR>
<TD ALIGN="right" VALIGN="top" width="110">
<FONT FACE="Verdana, Arial, Helvetica" SIZE="1" COLOR="#3399FF">
<xsl:value-of select="key('field_titles', name())/@title" />
</FONT>
</TD>
<TD ALIGN="left" VALIGN="top" width="380">
<FONT FACE="Verdana, Arial, Helvetica" SIZE="0" COLOR="#000000">
<xsl:copy-of select="./*|./text()"/>
</FONT>
</TD>
</TR>
</xsl:for-each>
<xsl:for-each select="*[@type='buttons']">
<TR>
<TD COLSPAN="2" ALIGN="right" VALIGN="top">
<FONT FACE="Verdana, Arial, Helvetica" SIZE="0" COLOR="#000000">
<xsl:copy-of select="./*|./text()"/>
</FONT>
</TD>
</TR>
</xsl:for-each>
</TABLE>
</form>
</CENTER>
</xsl:template>


</xsl:stylesheet>
--
Jo Bourne
Virtual Artists Pty Ltd

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.