Solved

input xml contains &lt; out contains <

Posted on 2007-11-21
9
292 Views
Last Modified: 2013-11-18
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 ">
    &lt;mx:PlotSeries ... &gt;
     &lt;mx:fills&gt;
      &lt;mx:SolidColor color="0xCC66FF"/&gt;
      &lt;mx:SolidColor color="0x9966CC"/&gt;
      &lt;mx:SolidColor color="0x9999CC"/&gt;
     &lt;/mx:fills&gt;
    &lt;/mx:PlotSeries&gt;
   </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

    &lt;mx:PlotSeries ... &gt;
     &lt;mx:fills&gt;
      &lt;mx:SolidColor color="0xCC66FF"/&gt;
      &lt;mx:SolidColor color="0x9966CC"/&gt;
      &lt;mx:SolidColor color="0x9999CC"/&gt;
     &lt;/mx:fills&gt;
    &lt;/mx:PlotSeries&gt;

Here the &lt; and &gt; is converting to '<' and '>'

How will i achieve this using xsl2.0?

Thanks,
Shailesh
0
Comment
Question by:ShaileshShinde
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 20333003
are you using a character class
or do you have disable-output-escaping set to true?
0
 
LVL 1

Author Comment

by:ShaileshShinde
ID: 20333021
Hello Expert,

None of these are using.

if i wanna use character class how will be the line of code/

Thanks,
Shailesh
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 20333023
Can you show me the template that does this?
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 1

Author Comment

by:ShaileshShinde
ID: 20333063
Hello Expert,

Here is the line of code...

<xsl:template match="pre">
            <xsl:variable name="product" select="./@product|./@class | ./@outputclass"/>
            <xsl:if test="string-length($product)=0 or not($product=concat($hiddenProductName,'only'))">
                  <xsl:value-of disable-output-escaping="yes" select="'&lt;pre&gt;'"/>
                  <xsl:call-template name="processTags"/>
                  <xsl:value-of disable-output-escaping="yes" select="'&lt;/pre&gt;'"/>
            </xsl:if>
      </xsl:template>
<xsl:template name="processTags">
            <xsl:param name="addParagraphTags" select="false()"/>
            <xsl:param name="createLinkFromRootContext" 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="yes" select="'&lt;p&gt;'"/>
                              </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="yes" select="'&lt;/p&gt;'"/>
                              </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="createLinkFromRootContext" select="$createLinkFromRootContext"/>
                        </xsl:apply-templates>
                  </xsl:if>
                  <xsl:if test="self::pre">
                        <xsl:apply-templates select="."/>
                  </xsl:if>
            </xsl:for-each>
      </xsl:template>
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 20333115
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 &lt; is shown as a <

cheers

Geert
0
 
LVL 1

Author Comment

by:ShaileshShinde
ID: 20333141
Hello Expert,

In browser it does appearring, but when i look at the source it's appears as '<'.
It should appear as '&lt;' in source, so it will appear in browser '<'

Thanks,
Shailesh
0
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 250 total points
ID: 20333321
If I run your templat on the XML it hows as &lt;
so you must check that you don't haev a character map active
can you show the xsl:output statement
0
 
LVL 1

Author Comment

by:ShaileshShinde
ID: 20333386
Hello Expert,

Yes, character map is active,i have disabled it and output is proper.

Thanks a lot!!
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 20333392
welcome
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question