• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XSLT needed

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
N Bhonsle
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
THis is resolved.

Thanks.
 
reply
    Bookmark Topic Watch Topic
  • New Topic