|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 1 stylesheet for many 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"?>
<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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








