0

hi all,
sorry i am posting on top of this mail
i have a problem
see one xml file look like
<my-app>
<name></name>
<!--<class></class>-->
</my-app>

i want to uncomment the commented part through xslt. please help me

thanks in advance

1
Contributor
3
Replies
4
Views
7 Years
Discussion Span
Last Post by vivek4075
0

<!-- the identity template copies everything
(unless more specific templates apply) -->
<xsl:template match="node() | @*">
<xsl:copy>
<xsl:apply-templates select="node() | @*" />
</xsl:copy>
</xsl:template>

<!-- this template matches comments and uncomments them -->
<xsl:template match="comment()">
<xsl:value-of select="." disable-output-escaping="yes" />
</xsl:template>

0

hi all please help me i am very new in this
see i ahve one xml file ::

<my-app>
<filter>
<filter-name>myrunclass</filtername>
<filter-class>myFirstClass</filter-class>
</filter>
<filter>
<filter-name>myCompileclass</filtername>
<filter-class>mySecondClass</filter-class>
</filter>
<filter>
<filter-name>myclass</filtername>
<filter-class>myThirdClass</filter-class>
</filter>

<!--<filter-mapping>
<filter-name>myrunclass</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>-->

<filter-mapping>
<filter-name>ResponseEncodingFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>

<!--<filter-mapping>
<filter-name>ResponseEncodingFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>-->
</my-app>

i need to uncomment the filter-mapping tag but based on some condition like inside <filter> if <filter-name> tag is match with commented <filter-mapping>/<filter-name> tag then we need to uncomment only those <filter-mapping> tag.

so OUTPUT become like


<my-app>
<filter>
<filter-name>myrunclass</filtername>
<filter-class>myFirstClass</filter-class>
</filter>
<filter>
<filter-name>myCompileclass</filtername>
<filter-class>mySecondClass</filter-class>
</filter>
<filter>
<filter-name>myclass</filtername>
<filter-class>myThirdClass</filter-class>
</filter>

<filter-mapping>
<filter-name>myrunclass</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>ResponseEncodingFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>

<!--<filter-mapping>
<filter-name>ResponseEncodingFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>-->
</my-app>

please help me

thanks in advance

Edited by vivek4075: FOR OutPUT

0

hi all please help me i am very new in this
see i ahve one xml file ::

<my-app>
<filter>
<filter-name>myrunclass</filtername>
<filter-class>myFirstClass</filter-class>
</filter>
<filter>
<filter-name>myCompileclass</filtername>
<filter-class>mySecondClass</filter-class>
</filter>
<filter>
<filter-name>myclass</filtername>
<filter-class>myThirdClass</filter-class>
</filter>

<!--<filter-mapping>
<filter-name>myrunclass</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>-->

<filter-mapping>
<filter-name>ResponseEncodingFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>

<!--<filter-mapping>
<filter-name>ResponseEncodingFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>-->
</my-app>

i need to uncomment the filter-mapping tag but based on some condition like inside <filter> if <filter-name> tag is match with commented <filter-mapping>/<filter-name> tag then we need to uncomment only those <filter-mapping> tag.

so OUTPUT become like


<my-app>
<filter>
<filter-name>myrunclass</filtername>
<filter-class>myFirstClass</filter-class>
</filter>
<filter>
<filter-name>myCompileclass</filtername>
<filter-class>mySecondClass</filter-class>
</filter>
<filter>
<filter-name>myclass</filtername>
<filter-class>myThirdClass</filter-class>
</filter>

<filter-mapping>
<filter-name>myrunclass</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>

<filter-mapping>
<filter-name>ResponseEncodingFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>

<!--<filter-mapping>
<filter-name>ResponseEncodingFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>-->
</my-app>

please help me

thanks in advance

i got the answer thanks a lot of you people help and thanks to Mr. Martin Honnen who gave me the solution

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.