www.webdeveloper.com
Results 1 to 8 of 8

Thread: Elements missing from output

  1. #1
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    95

    Question Elements missing from output

    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=".">&#160;<small>[#<xsl:value-of select="." />]</small></xsl:if>
    <xsl:text>)</xsl:text></i>
    </xsl:template>

  2. #2
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    2,653
    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..

  3. #3
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    95
    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.

  4. #4
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    2,653
    Can you post xml file ?..I'll run it and see whats going on..:-)

  5. #5
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    95

    Hope this is what you're asking for

    <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.

  6. #6
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    95
    Have uploaded the relevant files. Hope someone can help.
    Attached Files Attached Files

  7. #7
    Join Date
    May 2003
    Posts
    12

    Output mode

    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
    Last edited by tobysaville; 05-05-2003 at 09:41 PM.

  8. #8
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    95
    It didn't work. Still mystified.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles