ShaileshShinde
asked on
input xml contains &lt; out contains <
Hello Expert [Gertone],
I have an input xml which contains content as below....
<p class="- topic/p ">To set the value of this property using MXML:
<pre xml:space="preserve" class="- topic/pre ">
<mx:PlotSeries ... >
<mx:fills>
<mx:SolidColor color="0xCC66FF"/>
<mx:SolidColor color="0x9966CC"/>
<mx:SolidColor color="0x9999CC"/>
</mx:fills>
</mx:PlotSeries>
</pre>
</p>
and in output it appearing as ....
<p>To set the value of this property using MXML:
<pre>
<mx:PlotSeries ... >
<mx:fills>
<mx:SolidColor color="0xCC66FF"/>
<mx:SolidColor color="0x9966CC"/>
<mx:SolidColor color="0x9999CC"/>
</mx:fills>
</mx:PlotSeries>
</pre>
</p>
where as it should appear as
<mx:PlotSeries ... >
<mx:fills>
<mx:SolidColor color="0xCC66FF"/>
<mx:SolidColor color="0x9966CC"/>
<mx:SolidColor color="0x9999CC"/>
</mx:fills>
</mx:PlotSeries>
Here the < and > is converting to '<' and '>'
How will i achieve this using xsl2.0?
Thanks,
Shailesh
I have an input xml which contains content as below....
<p class="- topic/p ">To set the value of this property using MXML:
<pre xml:space="preserve" class="- topic/pre ">
<mx:PlotSeries ... >
<mx:fills>
<mx:SolidColor color="0xCC66FF"/>
<mx:SolidColor color="0x9966CC"/>
<mx:SolidColor color="0x9999CC"/>
</mx:fills>
</mx:PlotSeries>
</pre>
</p>
and in output it appearing as ....
<p>To set the value of this property using MXML:
<pre>
<mx:PlotSeries ... >
<mx:fills>
<mx:SolidColor color="0xCC66FF"/>
<mx:SolidColor color="0x9966CC"/>
<mx:SolidColor color="0x9999CC"/>
</mx:fills>
</mx:PlotSeries>
</pre>
</p>
where as it should appear as
<mx:PlotSeries ... >
<mx:fills>
<mx:SolidColor color="0xCC66FF"/>
<mx:SolidColor color="0x9966CC"/>
<mx:SolidColor color="0x9999CC"/>
</mx:fills>
</mx:PlotSeries>
Here the < and > is converting to '<' and '>'
How will i achieve this using xsl2.0?
Thanks,
Shailesh
ASKER
Hello Expert,
None of these are using.
if i wanna use character class how will be the line of code/
Thanks,
Shailesh
None of these are using.
if i wanna use character class how will be the line of code/
Thanks,
Shailesh
Can you show me the template that does this?
ASKER
Hello Expert,
Here is the line of code...
<xsl:template match="pre">
<xsl:variable name="product" select="./@product|./@clas s | ./@outputclass"/>
<xsl:if test="string-length($produ ct)=0 or not($product=concat($hidde nProductNa me,'only') )">
<xsl:value-of disable-output-escaping="y es" select="'<pre>'"/>
<xsl:call-template name="processTags"/>
<xsl:value-of disable-output-escaping="y es" select="'</pre>'"/>
</xsl:if>
</xsl:template>
<xsl:template name="processTags">
<xsl:param name="addParagraphTags" select="false()"/>
<xsl:param name="createLinkFromRootCo ntext" select="false()"/>
<xsl:variable name="matchHTML" select="./adobetable | ./ol | ./p | ./codeblock | ./ul | ./b | ./adobeimage | ./ph | ./codeph | ./bold | ./strong | ./em | ./i | ./xref | ./pre | ./text() | ./li| ./sup"/>
<xsl:for-each select="$matchHTML">
<xsl:if test="self::text()">
<xsl:if test="$addParagraphTags">
<xsl:if test="position()=1">
<xsl:value-of disable-output-escaping="y es" select="'<p>'"/>
</xsl:if>
</xsl:if>
<xsl:variable name="text">
<xsl:call-template name="search-and-replace">
<xsl:with-param name="search-string" select="'~~'"/>
<xsl:with-param name="replace-string" select="'*'"/>
<xsl:with-param name="input" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$text"/> Here i have added disable but still outputing wrong content.
<xsl:if test="$addParagraphTags">
<xsl:if test="position()=last()">
<xsl:value-of disable-output-escaping="y es" select="'</p>'"/>
</xsl:if>
</xsl:if>
</xsl:if>
<xsl:if test="self::codeblock">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="self::ol | self::ul">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="self::li">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="self::p">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="self::b | self::bold | self::strong">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="self::adobetable">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="self::adobeimage">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="self::ph">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="self::sup">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="self::em | self::i">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="self::codeph">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="self::xref">
<xsl:apply-templates select=".">
<xsl:with-param name="createLinkFromRootCo ntext" select="$createLinkFromRoo tContext"/ >
</xsl:apply-templates>
</xsl:if>
<xsl:if test="self::pre">
<xsl:apply-templates select="."/>
</xsl:if>
</xsl:for-each>
</xsl:template>
Here is the line of code...
<xsl:template match="pre">
<xsl:variable name="product" select="./@product|./@clas
<xsl:if test="string-length($produ
<xsl:value-of disable-output-escaping="y
<xsl:call-template name="processTags"/>
<xsl:value-of disable-output-escaping="y
</xsl:if>
</xsl:template>
<xsl:template name="processTags">
<xsl:param name="addParagraphTags" select="false()"/>
<xsl:param name="createLinkFromRootCo
<xsl:variable name="matchHTML" select="./adobetable | ./ol | ./p | ./codeblock | ./ul | ./b | ./adobeimage | ./ph | ./codeph | ./bold | ./strong | ./em | ./i | ./xref | ./pre | ./text() | ./li| ./sup"/>
<xsl:for-each select="$matchHTML">
<xsl:if test="self::text()">
<xsl:if test="$addParagraphTags">
<xsl:if test="position()=1">
<xsl:value-of disable-output-escaping="y
</xsl:if>
</xsl:if>
<xsl:variable name="text">
<xsl:call-template name="search-and-replace">
<xsl:with-param name="search-string" select="'~~'"/>
<xsl:with-param name="replace-string" select="'*'"/>
<xsl:with-param name="input" select="."/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$text"/> Here i have added disable but still outputing wrong content.
<xsl:if test="$addParagraphTags">
<xsl:if test="position()=last()">
<xsl:value-of disable-output-escaping="y
</xsl:if>
</xsl:if>
</xsl:if>
<xsl:if test="self::codeblock">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="self::ol | self::ul">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="self::li">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="self::p">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="self::b | self::bold | self::strong">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="self::adobetable">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="self::adobeimage">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="self::ph">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="self::sup">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="self::em | self::i">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="self::codeph">
<xsl:apply-templates select="."/>
</xsl:if>
<xsl:if test="self::xref">
<xsl:apply-templates select=".">
<xsl:with-param name="createLinkFromRootCo
</xsl:apply-templates>
</xsl:if>
<xsl:if test="self::pre">
<xsl:apply-templates select="."/>
</xsl:if>
</xsl:for-each>
</xsl:template>
Hey,
this template does exactly what you want it to do...
are you looking at the result in a browser?
In a browser of course, a < is shown as a <
cheers
Geert
this template does exactly what you want it to do...
are you looking at the result in a browser?
In a browser of course, a < is shown as a <
cheers
Geert
ASKER
Hello Expert,
In browser it does appearring, but when i look at the source it's appears as '<'.
It should appear as '<' in source, so it will appear in browser '<'
Thanks,
Shailesh
In browser it does appearring, but when i look at the source it's appears as '<'.
It should appear as '<' in source, so it will appear in browser '<'
Thanks,
Shailesh
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hello Expert,
Yes, character map is active,i have disabled it and output is proper.
Thanks a lot!!
Yes, character map is active,i have disabled it and output is proper.
Thanks a lot!!
welcome
or do you have disable-output-escaping set to true?