Page 1 of 1

Some XML XSLT transformation woes

Posted: 16 May 2009, 21:45
by DarkRanger
Not much. The following does work, I would just like to know if there is a simplified way of doing this.

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

Re: Some XML XSLT transformation woes

Posted: 16 May 2009, 21:50
by doo_much
Albert - dis Saterdag aan. Gaan drink! :lol:

Re: Some XML XSLT transformation woes

Posted: 16 May 2009, 21:56
by DarkRanger
Dis Saterdag aan, die bulle het gewen en ek sit en doen univ werk.

Ek het waaragtig my verstand verloor...

Re: Some XML XSLT transformation woes

Posted: 16 May 2009, 22:01
by doo_much
:)

Ek's actuallty trots op jou. Min ander mense sal daai een regkry! :lol:

Re: Some XML XSLT transformation woes

Posted: 16 May 2009, 22:04
by DarkRanger
:lol: :lol: