Some XML XSLT transformation woes
Posted: 16 May 2009, 21:45
Not much. The following does work, I would just like to know if there is a simplified way of doing this.
This is just the first of many steps... So what I would like to know, is there an easier way to get it to go through all the elements with the when and use it when the title in both documents work?
$thisTitle is the title of the current movie I'm working with (movie title being the actual thing as this is for a university project).
Thanks for any help.![Smile :)](./images/smilies/icon_smile.gif)
Code: Select all
<xsl:choose>
<xsl:when test="$thisTitle = document('reviews.xml')/trd:reviews/trd:review[1]/title">
<critic><xsl:value-of select="document('reviews.xml')/trd:reviews/trd:review[1]/critic"/></critic>
<score><xsl:value-of select="document('reviews.xml')/trd:reviews/trd:review[1]/score"/></score>
<body>
<xsl:for-each select="document('reviews.xml')/trd:reviews/trd:review[1]/body/paragraph">
<paragraph>
<xsl:value-of select="."/>
</paragraph>
</xsl:for-each>
</body>
<screenshots>
<xsl:for-each select="document('reviews.xml')/trd:reviews/trd:review[1]/screenshots/image">
<xsl:element name="image">
<xsl:attribute name="src">
<xsl:value-of select="@src"/>
</xsl:attribute>
<caption><xsl:value-of select="caption"/></caption>
</xsl:element>
</xsl:for-each>
</screenshots>
</xsl:when>
$thisTitle is the title of the current movie I'm working with (movie title being the actual thing as this is for a university project).
Thanks for any help.
![Smile :)](./images/smilies/icon_smile.gif)