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

Re: Variable Problems

Subject: Re: Variable Problems
From: "Joris Gillis" <roac@xxxxxxxxxx>
Date: Wed, 07 Sep 2005 12:56:06 +0200
variable problems
Tempore 11:09:50, die 09/07/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit James Game <jgame@xxxxxxxxxxxxxxxxxxxxxxx>:

Hi Joris (don't know what happened with previous post)

This is an example of data I have pulled from another source and I will be
looking for the same structure.  The fields are obviously named slightly
different but you get the idea.  This is the output I receive once run
through Oxygen using Xalan.

Im not too sure where the XML / XSL disagree (original post)- could you
point that out for me.


In your xslt, there ithis statement:

<xsl:variable name="price" select="price" />

This will put the 'price' element (the child node of the context node) in a variable called 'price'.

But there aren't any 'price' elements in your XML.


TRy this stylesheet:


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>

<xsl:output method="xml" />


<xsl:template match = "/" > <DATAPACKET Version="2.0"> <xsl:call-template name="CDSMetaData"/> <ROWDATA> <xsl:apply-templates/> </ROWDATA> </DATAPACKET> </xsl:template>

<xsl:template name="CDSMetaData">
	<METADATA>
		<FIELDS>
			<FIELD attrname="id" fieldtype="string" WIDTH="255"/>
			<FIELD attrname="price" fieldtype="string" WIDTH="255"/>
			<FIELD attrname="address1" fieldtype="string" WIDTH="255"/>
			<FIELD attrname="address2" fieldtype="string" WIDTH="255"/>
			<FIELD attrname="typedesc" fieldtype="string" WIDTH="255"/>
			<FIELD attrname="image" fieldtype="string" WIDTH="255"/>
			<FIELD attrname="bullets" fieldtype="string" WIDTH="255"/>
		</FIELDS>
	</METADATA>
</xsl:template>
		
<xsl:template match="desc">
<ROW>
	<xsl:apply-templates/>
</ROW>
</xsl:template>

<xsl:template match="detail">
	<xsl:attribute name="{@name}"><xsl:apply-templates/></xsl:attribute>
</xsl:template>

<xsl:template match="section[@name='bullets']/d">
	<xsl:attribute name="starpoint{position()}"><xsl:apply-templates/></xsl:attribute>
</xsl:template>

<xsl:template match="section[@name='pics']/g">
	<xsl:attribute name="image{position()}"><xsl:apply-templates/></xsl:attribute>
</xsl:template>

</xsl:stylesheet>


regards, -- Joris Gillis (http://users.telenet.be/root-jg/me.html) Gaudiam omnibus traderat W3C, nec vana fides

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.