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

xslt adds elements twice in xml.

Subject: xslt adds elements twice in xml.
From: Nishi Bhonsle <nishi.bhonsle@xxxxxxxxxx>
Date: Thu, 17 Feb 2005 12:38:13 -0800
usecachedsession
Hi:

I have the following xml snippet:
<portlet logLevel="error">
<enablePortlet status="true"></enablePortlet>
<sessionPool maxSessions="20" useCachedSession="true" maxSessionAgeHour="1" maxSessionInactivityPeriodMinute="10"></sessionPool>
</portlet>


I need to write a xsl which transforms the above xml to the following xml--

<portlet logLevel="error" pickerCompatibleVersions="10.1.2" maxDataRows="1000" logLevel="error">
<enablePortlet status="true"/>
<sessionPool maxSessions="20" useCachedSession="true" maxSessionAgeHour="35" maxSessionInactivityPeriodMinute="17" maxRefreshWaitMinute="1" maxRefreshRetries="1" maxGenericParameters="10"
maxNewSessionPerMinute="6" maxWaitNewSessionMinute="30"/>
</portlet>



I wrote the following, but it adds the enablePortlet element and the sessionPool element twice in the resultant file --


<xsl:template match="portlet">
<xsl:copy>
<xsl:attribute name="pickerCompatibleVersions"><xsl:text>10.1.2</xsl:text></xsl:attribute>
<xsl:attribute name="maxDataRows"><xsl:text>1000</xsl:text></xsl:attribute>
<xsl:copy-of select="@*"/>


<xsl:element name="sessionPool">
<xsl:attribute name="maxRefreshWaitMinute"><xsl:text>1</xsl:text></xsl:attribute>
<xsl:attribute name="maxRefreshRetries"><xsl:text>1</xsl:text></xsl:attribute>
<xsl:attribute name="maxGenericParameters"><xsl:text>10</xsl:text></xsl:attribute>
</xsl:element>
<xsl:apply-templates/>
</xsl:copy>
<xsl:copy-of select="enablePortlet"/>
</xsl:template>


What am I doing wrong in the xslt? Can someone please help.

Thanks much.

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.