Quote:
Originally Posted by ngquochung86
I've just figured out how to do this, so there's no need to reply for this post. This post is now closed.
|
you could post your solution maybe somebody will have same problem.
Quote:
Originally Posted by ngquochung86
My XML code:
Code:
<quotes>
<quote>
<!--play 1-->
<play title="All's Well That Ends Well new">
<act>
<acttitle>ACT IV</acttitle>
<scene title="SCENE I">
<speech>
<speaker>
<name>LAFEU This is lafeu</name>
</speaker>
<line>He hath abandoned his physicians, madam; under whose
practises he hath persecuted time with hope, and
finds no other advantage in the process but only the
losing of hope by time helllo world hello world hahah</line>
</speech>
</scene>
</act>
</play>
</quote>
In the code above, I try to write the location path to locate the @ title of the scene and the play
Code:
<xsl:value-of select="quote::descendent::act::child::@title"/>
<xsl:value-of select="quote::child::@title"/>
I don't know why the 2 location path does not work. Would you please help me ?
|
the way you write the path is incorrect but I guess you already discover this..
the path is relative to the template where you use. For example if you have a template for /quotes/quote/play will look like this:
Code:
<xsl:template match="play">
<!-- second title -->
<xsl:value-of select="act/scene/@title"/>
<!-- first title -->
<xsl:value-of select="@title"/>
</xsl:template>
on the other hand if you have distinct templates for play and @title:
Code:
<xsl:template match="play">
<xsl:apply-templates select="act/scene/@title"/>
<xsl:apply-templates select="@title"/>
</xsl:template>
<xsl:template match="@title">
<xsl:value-of select="."/>
</xsl:template>
there are also few other combination.
best regards