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

Building attributes using another template, context no

Subject: Building attributes using another template, context node?
From: "Manos Batsis" <m.batsis@xxxxxxxx>
Date: Thu, 25 Oct 2001 12:27:51 +0300
building attributes
Hi folks, 

I would really appreciate some help on this one :-)
Suppose I have the following:

<html:table cellspacing="0" cellpadding="0" xed:nodeType="element"
xmlns:xed="http://www.foo.org/foo/">
	<html:tr>
		<html:td class="elemType">
			<html:button class="shown"/>
			<html:p
class="elemNameTextArea">xsl:stylesheet</html:p>
		</html:td>
		<html:td class="childHolder">
			<html:div class="hide">
				<html:table cellspacing="0"
cellpadding="0" xed:nodeType="attribute">
					<html:tr>
						<html:td
class="attrType">
							<html:button
class="hidden"/>
							<html:p
class="elemAttrTextArea">version</html:p>
						</html:td>
						<html:td>
							<html:p
class="xedValue" xed:areaType="attrValue">1.0</html:p>
						</html:td>
					</html:tr>
				</html:table>
			</html:div>
		</html:td>
	</html:tr>
</html:table>

I have a template that matches the outer table with the
xed:nodeType="element" attribute-value pair. I use it to output an
element from the html:p in it's first TD. 
Now, the problem. I am trying to construct the attribute of that
element, using the inner table (the one with the
xed:nodeType="attribute"). My template for the first table is:

<xsl:template match="table[@xed:nodeType='element']">
    <xsl:element name="{tr/td[@class='elemType']/p/text()}"
xml:space="preserve">
      <xsl:apply-templates
select="tr/td[@class='childholder']/div/table"  mode="scrapattrs"/>
      <xsl:apply-templates/>
   </xsl:element>
</xsl:template>

This is a really messed up version of the second template... 

<xsl:template name="scrapattrs" mode="scrapattrs"
match="table[@xed:nodeType='attribute']">
   <xsl:attribute name="{tr/td[@class='attrType']/p/text()}">
	<xsl:value-of select="tr/td/p[@areaType='attrValue']/text()"/>
   </xsl:attribute>
</xsl:template>

Can you point me to modifications needed to build the element and it's
properties?
Thank you very much for your time.

Kindest regards,

Manos

 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.