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

Re: Problem with parsing nodes saved in variable

Subject: Re: Problem with parsing nodes saved in variable
From: "Ranjan K. Baisak" <ranjanbaisak@xxxxxxxxx>
Date: Wed, 13 Jul 2005 02:45:04 -0700 (PDT)
parse variable xsl
You need to convert it to node-set before usage.
XSLT2.0 supports by directly using it as node-set.
However in XSLT1.0, you need to explicitly convert it
to node-set like

<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exslt="http://exslt.org/common"
extension-element-prefixes="exslt">

<xsl:template match="/">
	<xsl:variable name="myVar">
	<xsl:apply-templates />
	</xsl:variable>
	<xsl:for-each select="exslt:node-set($myVar)/*">
		........
	</xsl:for-each>
	.........
</xsl:template>

--- Lakshmi narayana <lchintala@xxxxxxxxxxxx> wrote:

> 
> Hi,
> This is my xml file.
> <A1 name="(R) MSH" sequence="1"
> Description="optional" >
>          <B1 name="B1" sequence="5"
> order="first"></B1>
>          <B2 name="B1" sequence="102" order="first"
> >
>                   <C1 name="C1" sequence="201"
> order="Sec" ></C1>
>                   <C2 name="C2" sequence="202"
> order="Sec" >
> 							<C3/>
>                            <D1 name="D1" 
> sequence="11" Max="1"
> Reference="Trr" Predicate="" />
>                   </C2>
>          </B2>
> </A1>
> 
> I wrote an XSLT which dynamically adds attibute
> named Type to each node. I
> wrote the XSLT like this.
> 
> <xsl:template match="/">
> 	<xsl:variable name="myVar">
> 	<xsl:apply-templates />
> 	</xsl:variable>
> </xsl:template>
> <xsl:template match="/A1">
> 	<xsl:element name="IEElement">
> 		<xsl:attribute name="Type">
> 			<xsl:text>A-Type</xsl:text>
> 		</xsl:attribute>
> 	</xsl:element>
> </xsl:template>
> <xsl:template match="/B1">
> 	<xsl:element name="IEElement">
> 		<xsl:attribute name="Type">
> 			<xsl:text>B-Type</xsl:text>
> 		</xsl:attribute>
> 	</xsl:element>
> </xsl:template>
> 
> In the above XSLT, how can I parse through each node
> saved in variable and
> access the dynamically created attribute 'Type'.
> Based on that,
> I want to do some processing.
> 
> Thanks,
> Laxmi Narayana
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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.