[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Problem making a transformation

Subject: Problem making a transformation
From: "Miguel Carvalho" <mig.carv@xxxxxxxxxxxxxxx>
Date: Mon, 11 Aug 2003 12:32:55 +0100
miguel carvalho
hi, i am trying to create a transformation that takes a piece of XML and
apply a XSL sheet, but i'm having some troubles that i don't understand
why...

<!-- XML Fragment -->

<document xmlns:xsp="http://apache.org/xsp"
xmlns:util="http://apache.org/xsp/util/2.0"
xmlns:xml="http://www.w3.org/XML/1998/namespace">

<contents>

<article xmlns:src="http://xml.apache.org/xindice/Query" xpos="5" ypos="7"
layouttype="3" border="dotted">
<title>Titulo com rating 2</title>
<text>Texto</text>
</article>
<article xpos="5" ypos="7" layouttype="3" border="dotted"
xmlns:src="http://xml.apache.org/xindice/Query">
<title>Titulo do artigo com rating igual a 1</title>
<text>texto do artigo com rating igual a 1</text>
<image>img1.jpg</image>
</article>
<article xpos="5" ypos="7" layouttype="3" border="dotted"
xmlns:src="http://xml.apache.org/xindice/Query">
<title>Titulo do artigo com rating igual a 2</title>
<text>texto do artigo com rating igual a 2</text>
<image>img1.jpg</image>
</article>
<article xpos="5" ypos="7" layouttype="3" border="dotted"
xmlns:src="http://xml.apache.org/xindice/Query">
<title>Titulo do artigo com rating igual a 2</title>
<text>texto do artigo com rating igual a 2</text>
<image>img1.jpg</image>
</article>

</contents>

</document>


and this is the stylesheet..

<!-- XSL Stylesheet -->


<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

    <xsl:template match="/">
        <xsl:apply-templates select="document"/>
    </xsl:template>

    <xsl:template match="contents">
        <xsl:apply-templates select="article[@layouttype = '3']"
mode="layouttype3"/>
    </xsl:template>

    <xsl:template mode="layouttype3">
        layout 3

        <xsl:value-of select="title"/>
        <xsl:value-of select="text"/>

                    <img>
                        <xsl:attribute name="src">
                            <xsl:value-of select="article/image"/>
                        </xsl:attribute>
                    </img>

    </xsl:template>

</xsl:stylesheet>

The problem here is that i can't get it to select the <article> that has the
attribute @layouttype = 3. I've tried some vaiations of this but with no
success.

Thanks in advance
Miguel Carvalho



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.