Click to See Complete Forum and Search --> : Elements missing from output
sheila
04-28-2003, 08:14 PM
I have a template that should produce plain text within <i> tags but the formatting tags are mysteriously missing from the result. This happened even when I changed them to <span> and yet when I inserted an asterisk (to check that the template is being processed), it appeared. I am using nested templates - is there a limit beyond which they become unreliable?
Here's the relevant code snippets:
<xsl:template match="title" mode="with-series">
<xsl:variable name="bookid" select="parent::book/@id" />
<xsl:variable name="clean-bookid" select="substring-after($bookid, 'BOO')" />
<xsl:variable name="title" select="." />
<p class="title">
<a href="reviews/book.asp?id={$clean-bookid}">
<xsl:value-of select="$title" />
<xsl:apply-templates select="following-sibling::series" />
</a>
<xsl:apply-templates select="parent::book/awards/award[@ref='AWA1']" />
</p>
</xsl:template>
<xsl:template match="series">
<xsl:variable name="seriesid" select="@ref" />
<i><xsl:text> (</xsl:text>
<xsl:value-of select="$series/descendant::series[@id=$seriesid]/title" />
<xsl:if test="."> <small>[#<xsl:value-of select="." />]</small></xsl:if>
<xsl:text>)</xsl:text></i>
</xsl:template>
khalidali63
04-28-2003, 10:09 PM
The only thing I can "guess" is that you are not retrieving values from the xml file...make sure all of your xslt variables are returning values..
sheila
04-29-2003, 01:42 PM
The variables are all working. The 'dysfunctional' template is the second one (match="series"). The brackets, series name and sequence number are all output correctly. It's just the <i> tags that fail to get outputted.
khalidali63
04-29-2003, 05:23 PM
Can you post xml file ?..I'll run it and see whats going on..:-)
sheila
04-30-2003, 04:51 PM
<books>
<book id="BOO4" status="display" eligible="yes">
<title>The Other Wind</title>
<series ref="SER47">5</series>
<published isbn="1842552058" date="2002-05-02" />
<creators><author ref="CRE4" /></creators>
<synopses>
<synopsis><p>The wizard Alder comes from Roke to the island of Gont in search of the Archmage, Lord Sparrowhawk, once known as Ged. The man who was once the most powerful wizard in the Islands now lives with his wife Tenar and their adopted daughter Tehanu. Alder needs help: his beloved wife died and in his dreams she calls him to the land of the dead - and now the dead are haunting him, begging for release. He can no longer sleep, and the Wizards of Earthsea are worried.But there is more at stake than the unquiet rest of one minor wizard: for the dragons of Earthsea have arisen, to reclaim the lands that were once theirs. Only Tehanu, herself daughter of a dragon, can talk to them; it may be that Alder's dreams hold the key to the salvation of Earthsea and all the peoples who live there.</p></synopsis>
</synopses>
</book>
<book id="BOO5" status="display" eligible="yes">
<title>Otto and the Flying Twins</title>
<series ref="SER53">1</series>
<published isbn="0340855932" date="2002-09-12" />
<creators><author ref="CRE6" /></creators>
<synopses>
<synopsis><p>When Otto sees his father soothing what looks very much like a purple dragon, he finds his world suddenly becoming very odd. He discovers that his family and his city are the last remnants of the ancient magical world now under threat from the new human Normal Police, and something must be done.</p></synopsis>
</synopses>
</book>
</books>
The code below is from another file called series.xml. It is referenced from stylesheet as $series using a global parameter:
<xsl:param name="series" select="document('series.xml')" />
<names>
<series id="SER47">
<title>The Earthsea Quintet</title>
</series>
<series id="SER53">
<title>The Karmidee</title>
</series>
</names>
PS. The <small> tags disappear as well.
sheila
05-05-2003, 06:52 PM
Have uploaded the relevant files. Hope someone can help.
tobysaville
05-05-2003, 09:38 PM
Try changing the <xsl: output> method attribute to html instead of xml, at the top of the XSL file. I had that problem a while ago.
- toby
sheila
05-27-2003, 11:24 AM
It didn't work. Still mystified.