View Single Post
zarlor
Senior Member
 
Join Date: Nov 2010
Location: Metairie, LA, USA
Posts: 1,819

Old November 16th, 2012, 08:52 AM
So I guess I'll work on figuring this out, but I need some help. I've worked out more than a few things from the DTD and how to present them but there are some things I can't seem to get working and I'm wondering if anyone here might be able to help me with it.

I'll start off with trying to display Magic Items. I used the Gear entries to make this sort of work as a comma separated list.

First off the lines telling it to display look like:
Quote:
<!-- Magical gear -->
<p class="magicitem">
<xsl:apply-templates select="magicitems/magicitem"/>
</p>
Next the template that tells it how to display:

Quote:
<!-- Add a comma before all magic items but the first -->
<xsl:template match="magicitems/magicitem">
<xsl:if test="position() != 1">
<xsl:text>, </xsl:text>
</xsl:if>

<!-- Display the name and quantity - note the lack of newlines / indents
here which make it ugly, but are require to avoid introducing extra
white space which makes the output look bad -->
<xsl:value-of select="@name"/>: <xsl:value-of select="@description"/>, <xsl:value-of select="@enchantments"/><xsl:if test="@quantity != 1">
(x<xsl:value-of select="@quantity"/>)</xsl:if></xsl:template>
Again most of that is a direct copy from the sample statblock.xsl file. What I get for output looks like:

Quote:
Armbands of Strength: , , Cloak of Shadows: , , Goggles of the Eagle: , , Griffin Statuette: , , Handy Haversack: , , Thieve's Picks: ,
So no real description or enchantments print out.

So from the DTD I can see that there is an ELEMENT entry for "magicitems" with a parenthetical list that includes "magicitem*" in it. Later there is another ELEMENT for "magicitem" with another parenthetical list that includes"description", for example. So it seems that description would not be an @description item, but something different and I don't see any good examples of stuff that is nested 3 deep instead of only 1 or 2 deep. Any ideas?

Lenny Zimmermann
Metairie, LA, USA

Data files authored (please let me know if you see any issues with any of these if you have/use them):
Official (In the downloader)
50 Fathoms, Deadlands: Hell On Earth, Deadlands: Noir, East Texas University, Necessary Evil (requires Super Powers Companion), Pirates of the Spanish Main, Space 1889 (original file by Erich), Tour of Darkness, Weird War II, Weird Wars: Rome
Coming Eventually
Evernight (LWD has completed their review but I have some fixes to make first... although Pinnacle mentioned this might get an overhaul to SWADE so I may just wait for that first. If you just HAVE to have this now, though, just PM me)
zarlor is offline   #2 Reply With Quote