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

badly need xsl help

Subject: badly need xsl help
From: "Murali Korrapati" <murali.korrapati@xxxxxxxxx>
Date: Mon, 13 Oct 2003 10:48:11 -0400
xmlns msxsl
Hi,
  I posted this question here before. But I didn't get any luck. So trying again with some more details.

In this example, I can't access individual  nodes inside RegOptions in the script.

xml:

<data xmlns="urn:schemas.abcd-com:layers">
	<Rpt_Inven xmlns="urn:schemas.abcd-com:RepInven" />
	<RegionalOptions xmlns="urn:schemas.abcd-com:Static">
		<Currency>
			<DecimalSymbol>.</DecimalSymbol>
			<GroupingSymbol>,</GroupingSymbol>
			<DigitGrouping>2</DigitGrouping>
		</Currency>
		<Locale>1033</Locale>
		<Date>
			<Calendar>
			<TwoDigitYear>79</TwoDigitYear>
			</Calendar>
			<Separator>-</Separator>
			<ShortFormat>3</ShortFormat>
		</Date>
	</RegionalOptions>
</data>


xsl :

<xsl:stylesheet version="1.0" xmlns="" xmlns:lay="urn:schemas.abcd-com:layers" xmlns:rep="urn:schemas.abcd-com:RepInven" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:scrdt="urn:schemas.abcd-com:datatypes" 
xmlns:stat="urn:schemas.abcd-com:Static">
	<xsl:output method="xml" encoding="UTF-8"/>
	<xsl:template match="lay:data">
		<_Ctrl>
			<xsl:call-template name="callInit">
				<xsl:with-param name="regOptNode" select="stat:RegionalOptions"/>
			</xsl:call-template>
  		</_Ctrl>
	</xsl:template>
	 <xsl:template name="callInit">
		<xsl:param name="regOptNode"/>
		<_Item>
			<xsl:value-of select="scrdt:init($regOptNode)"/>
		</_Item>
	</xsl:template>
	<msxsl:script language="JScript" implements-prefix="scrdt"><![CDATA[

function init(RegOpts)
{
	if( !RegOpts.length) return "length 0";
	for( i = 0; i < RegOpts.length; i++ ) {
		xDate.init(RegOpts(i));
		xNumber.init(RegOpts(i));
		var val = RegOpts(i).selectSingleNode("Currency");
//		var val = RegOpts(i).firstChild;
		
		if(val!=null)
			return val.xml;
	}
	return "End";
}
	]]></msxsl:script>

</xsl:stylesheet>

    With this xml and xsl, I am expecting my out some thing like

<_Ctrl xmlns="" xmlns:lay="urn:schemas.abcd-com:layers" xmlns:rep="urn:schemas.abcd-com:RepInven" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:scrdt="urn:schemas.abcd-com:datatypes" 
xmlns:stat="urn:schemas.abcd-com:Static">
	<_Item>
		&lt;DecimalSymbol&gt;.&lt;/DecimalSymbol&gt;
		&lt;GroupingSymbol&gt;,&lt;/GroupingSymbol&gt;
		&lt;DigitGrouping&gt;2&lt;/DigitGrouping&gt;
	</_Item>
</_Ctrl>

   But it is always producing something like 

   <_Ctrl xmlns="" xmlns:lay="urn:schemas.abcd-com:layers" xmlns:rep="urn:schemas.abcd-com:RepInven" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:scrdt="urn:schemas.abcd-com:datatypes" 
xmlns:stat="urn:schemas.abcd-com:Static">
	<_Item>
		End
	</_Item>
</_Ctrl>


      I think this b'cos I am not able to get access to the <Currency/> node in the script function. And whenever I say RegOpts(i).firstChild , I am getting the result I want. 

Any ideas about. I am very desperate for this.

thanks,

~Mur




 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.