Ok.  I got this from a website as an example, so assumed it was valid.  I'll
trim way down and see what happens.

Andy

-----Original Message-----
From: Barney Boisvert [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 13, 2005 8:25 PM
To: CF-Talk
Subject: Re: Displaying XML with XSL....

I dunno.  Try trimming down both the XML and the XSL to a bare minimum
example, and then building back up from there.  I.e. something like
<root><name id="4">andy</name></root> and use XSL to turn it into
<strong>hello, andy (4)</strong> or something.  If that doesn't work,
try posting again.  It'll be a lot easier to help without having to
wade through a hundred lines of unfamiliar XML and XSL.

cheers,
barneyb

On 9/13/05, Andy <[EMAIL PROTECTED]> wrote:
> I am trying to display XML-based data using an XSL.  The following throws
an
> error on the transform statement.  What am I doing wrong.
> 
> 
> 
> <cfxml variable="xmlString" >
> 
>             <invoice date = "2003-08-15">
> 
>                         <line-item quantity = "2" upc = "ID234">
> 
>                                     <description> catcher mit
</description>
> 
>                                     <price currency = "usd"> 250.53
</price>
> 
>                         </line-item>
> 
>                         <line-item quantity = "5" upc = "ID911">
> 
>                                     <description> baseball bat
> </description>
> 
>                                     <price currency = "usd"> 38.22
</price>
> 
>                         </line-item>
> 
>                         <line-item quantity = "1" upc = "ID1890">
> 
>                                     <description> catcher mask
> </description>
> 
>                                     <price currency = "usd"> 45.00
</price>
> 
>                         </line-item>
> 
>             </invoice>
> 
> </cfxml>
> 
> 
> 
> <cfset xmlStyle = '
> 
> <?xml version = "1.0"?>
> 
> <xsl:stylesheet
> 
>    xmlns:xsl = "http://www.w3.org/1999/XSL/Transform";
> 
>    version = "1.0">
> 
> <xsl:template match = "invoice">
> 
>    <xsl:variable name = "nodes" select = "//product"/>
> 
>    <html>
> 
>    <head><title> XSL Demo </title></head>
> 
>    <body>
> 
>       <table align = "center" width = "75%" border = "4">
> 
>          <caption align="top"> Your Invoice </caption>
> 
>       <tr>
> 
>          <th width="30%"> Description </th>
> 
>          <th width="20%"> Quantity </th>
> 
>          <th width="30%"> Price </th>
> 
>       </tr>
> 
>       <xsl:for-each select = "line-item">
> 
>        <tr>
> 
>           <td align = "center">
> 
>             <xsl:value-of select = "description"/> </td>
> 
>           <td align = "center">
> 
>             <xsl:value-of select = "@quantity"/>
> 
>          </td>
> 
>           <td align = "center">
> 
>             $<xsl:value-of select = "price"/>
> 
>          </td>
> 
>        </tr>
> 
>       </xsl:for-each>
> 
>       </table>
> 
>       <br/><br/>
> 
>       Your total is $
> 
>       <xsl:call-template name = "getTotal">
> 
>          <xsl:with-param name = "items" select = "line-item"/>
> 
>          <xsl:with-param name = "total" select = "0"/>
> 
>       </xsl:call-template>
> 
>    </body>
> 
>    </html>
> 
> </xsl:template>
> 
> 
> 
> <xsl:template name = "getTotal">
> 
>    <xsl:param name = "items"/>
> 
>    <xsl:param name = "total"/>
> 
>    <xsl:choose>
> 
>          <xsl:when test = "$items">
> 
>             <xsl:variable name = "temp"
> 
>                select = "$items[1]/price * $items[1]/@quantity"/>
> 
>             <xsl:call-template name = "getTotal">
> 
>                <xsl:with-param name = "items"
> 
>                   select = "$items[position() != 1]"/>
> 
>                <xsl:with-param name = "total"
> 
>                         select = "$total + $temp"/>
> 
>             </xsl:call-template>
> 
>          </xsl:when>
> 
>          <xsl:otherwise>
> 
>             <xsl:value-of select = "$total"/>
> 
>          </xsl:otherwise>
> 
>       </xsl:choose>
> 
>    </xsl:template>
> 
> 
> 
> </xsl:stylesheet>
> 
> ' />
> 
> 
> 
> <cfoutput>#xmlTransform(xmlString, xmlStyle)#</cfoutput>
> 
> 
> 
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:218145
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to