Week 5 Homework: Partial View Of Each Narrative

  • Please log in to reply
1 reply to this topic

#1 jyurow


    Active Member

  • Members
  • PipPip
  • 31 posts

Posted 20 November 2010 - 07:50 PM

I wanted to show the values of all para, image, and photoReference elements, but none other, for each of the narratives, separating the narratives with horizontal lines. I was able to come up with a solution that works and wanted to share it with the class.

First, I removed the [id='@(specific id)'] clause to get all narratives instead of a specific narrative.

Second, I modified the tag: <xsl:apply-templates select="description"/> to read

<xsl:apply-templates select="description[descendant::para|descendant::image|descendant::photoReference]"/>. (Oxygen suggested "descendant::" and I guessed that "|" might be the symbol for "or.")

This worked fine for all the narratives but one, "narr_walk_butt". This narrative has three photoReference tags in succession, the values of which the transformation processor concatenated onto a single line. The reason for this is that Bob's template library BodyElements.xsl contains no template for the photoReference element. It seems that the XSL processor used a default "value-of" template to simply extract the three photoReference values and produced this messy result.

To remedy this, I added an additional template to the BodyElements.xsl file that reads:

<xsl:template match="photoReference">
<p><xsl:value-of select="."/></p>

This causes the last three photoReference values in id="narr_walk_butt" to appear on three separate lines, within <p></p> tags, as I think they should.

Edited by jyurow, 20 November 2010 - 07:51 PM.

#2 jyurow


    Active Member

  • Members
  • PipPip
  • 31 posts

Posted 23 November 2010 - 08:38 AM

After watching the Week 6 class, I changed the value of the select attribute to read:


This also works, but has the advantage of being something that Bob demonstrated in class, rather than the more advanced:

select="description[descendant::para|descendant::image|descendant::photoReference]", which was something that Oxygen happened to suggest.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users