Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 20th, 2004, 08:33 AM
Authorized User
 
Join Date: Apr 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default XSL transformation

I have the following xsl file but when I apply it to a recordset I get more than once (actually the number of recorset rows) the stuff that were supposed to be displayed based on the first template (t1)
(for example <title>case1case1case1</title> if the recordset has 3 rows). Instead I expect to have <title>case1</title>.
The xsl follows:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        xmlns:rs="urn:schemas-microsoft-com:rowset"
              xmlns:z="#RowsetSchema"
          xmlns:rss="http://purl.org/rss/0.91">

    <xsl:output encoding="UTF-8" />
    <xsl:template match="/">
        <rss version="0.91">
            <xsl:apply-templates/>
        </rss>
    </xsl:template>
    <xsl:template match="rs:data">
        <channel>
            <title><xsl:apply-templates select="z:row" mode="t1"/>
            </title>
            <xsl:apply-templates select="z:row" mode="t2"/>
        </channel>
    </xsl:template>
    <xsl:template name="t1" match="z:row" mode="t1">
        <xsl:choose>
        <xsl:when test="@case = '1'"><xsl:text>case1</xsl:text></xsl:when>
        <xsl:when test="@case = '2'"><xsl:text>case2</xsl:text></xsl:when>
        <xsl:otherwise><xsl:text>NO case found</xsl:text></xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    <xsl:template name="t2" match="z:row" mode="t2">
        <item>
            <description><xsl:value-of select="@last_inserted"/></description>
        </item>
    </xsl:template>
</xsl:stylesheet>

Any ideas?!
Thanks in advance,

Theodore.






Similar Threads
Thread Thread Starter Forum Replies Last Post
xsl transformation ... rajesh_css XSLT 5 September 30th, 2008 12:37 AM
XSL-Transformation atulshin XSLT 4 September 15th, 2008 06:37 AM
WML and XSL transformation. Feodorov XSLT 2 February 13th, 2008 05:00 PM
XSL transformation problem kawal.singh XSLT 2 December 5th, 2006 05:58 AM
XSL Transformation problem dzyrd7 XSLT 2 November 23rd, 2006 01:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.