11-01-2017, 09:28 AM | #1 |
Join Date: Dec 2005
Location: Giessen/Hessen/Germany
|
(Ab-?)Using GCA files as HTML table reference/shopping list
Hi guys,
I had an idea I'd like to share with you, namely, to display the existing GCA data files' equipment sections as a sortable, filterable shopping list (like in this screenshot). Since this uses existing data (.GDF data sheets) and mechanisms (a .GCE export sheet), I'm confident that it wouldn't violate SJGames online policy... possibly as long as one has a valid GCA4 license to get at the "official" GDF files and actually use a GCE export sheet on them. What you need:
Here's how it works:
Example XSL Sheet for a bland, English-only HTML table: Code:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" indent="yes"/> <xsl:template match="/"> <html> <body> <h1>GURPS Equipment (XSLT Conversion from GCA Files)</h1> <p><a href="index.php">Back to Index</a></p> <table border="1" cellspacing="0" cellpadding="2" color="#DDDDDD" style="border:1px solid #ddd;"> <tr> <th>Item</th> <th>Cost</th> <th>Weight</th> <th>LC</th> <th>TL</th> <th>Page</th> <th>Other Info</th> </tr> <xsl:apply-templates/> </table> </body> </html> </xsl:template> <xsl:template match="equipment"> <xsl:for-each select="*"> <!-- take all descendants of equipment (ID tags) --> <tr> <!--<td><xsl:value-of select="local-name()"/></td>--> <td><xsl:value-of select="./name"/></td> <td><xsl:value-of select="./basecost"/> <xsl:text>$</xsl:text> </td> <td><xsl:value-of select="./baseweight"/> <xsl:text>lbs.</xsl:text> </td> <td> <xsl:choose> <xsl:when test="./lc != ''"> <xsl:value-of select="./lc"/> </xsl:when> <xsl:otherwise> <xsl:text>4</xsl:text> </xsl:otherwise> </xsl:choose> </td> <td> <xsl:choose> <xsl:when test="./tl != ''"> <xsl:value-of select="./tl"/> </xsl:when> <xsl:otherwise> <xsl:text>3</xsl:text> </xsl:otherwise> </xsl:choose> </td> <td><xsl:value-of select="./page"/></td> <td style="font-size:0.8rem"> <xsl:choose> <xsl:when test="./damage != ''"> <xsl:text>Dam: </xsl:text> <xsl:value-of select="./mode"/> <xsl:text> </xsl:text> <xsl:value-of select="./damage"/> <xsl:text> </xsl:text> <xsl:value-of select="./damtype"/> <xsl:text> / R: </xsl:text> <xsl:value-of select="./reach"/> <xsl:text> Parry: </xsl:text> <xsl:value-of select="./parry"/> <xsl:text> MinST: </xsl:text> <xsl:value-of select="./minst"/> <xsl:text> / Acc: </xsl:text> <xsl:value-of select="./acc"/> <xsl:text> ½D: </xsl:text> <xsl:value-of select="./rangehalfdam"/> <xsl:text> Max: </xsl:text> <xsl:value-of select="./rangemax"/> <xsl:text> RoF: </xsl:text> <xsl:value-of select="./rof"/> <xsl:text> Shots: </xsl:text> <xsl:value-of select="./shots"/> <xsl:text> Blk: </xsl:text> <xsl:value-of select="./bulk"/><br/> </xsl:when> </xsl:choose> <xsl:choose> <xsl:when test="./dr != ''"> <xsl:text>DR: </xsl:text> <xsl:value-of select="./dr"/> <xsl:text> </xsl:text><xsl:value-of select="./location"/><br/> </xsl:when> </xsl:choose> <xsl:choose> <xsl:when test="./skillused != ''"> <xsl:text>Skill: </xsl:text> <xsl:value-of select="./skillused"/> <xsl:text> / </xsl:text> </xsl:when> </xsl:choose> <xsl:choose> <xsl:when test="./notes != ''"> <xsl:text> Notes: </xsl:text> <xsl:value-of select="./notes"/> <br/> </xsl:when> </xsl:choose> <xsl:choose> <xsl:when test="./description != ''"> <xsl:text> Desc: </xsl:text> <xsl:value-of select="./description"/> <br/> </xsl:when> </xsl:choose> <xsl:text> Cat: </xsl:text> <xsl:value-of select="./cat"/> <br/> </td> </tr> </xsl:for-each> </xsl:template> <!-- do nothing for unmatched text or attribute nodes --> <xsl:template match="text()|@*"/> </xsl:stylesheet> Christopher
__________________
Liantefaron - Hunter of Spiders Woodelven Ranger Real Name: Christopher. steinmetze.org (with my GCA-datafiles) has perished in 2012. Try an archive.org version if you need them. Last edited by Liantefaron; 11-01-2017 at 10:17 AM. |
Tags |
gca4, gdf, html, xml |
Thread Tools | |
Display Modes | |
|
|