\" signs in xslt have to look \"Img>\"OR \"<Img\"" />
开发者

XSLT concat Issue?

Pls any one help me to concat 'Img' and "<" or ">" signs in xslt

have to look "Img>" OR "<Img"

Update from comments:

<Content><![CDATA[<P>dfsfdsfdsfdsfdsfdsfsd</P>
                  <P><IMG alt="" hspace=0 
                          src="../../Repository.aspx?uri=4343"
                          border=0></P>
                  <P>fdsfsdfsdfsdf</P>
                  <P>fdsfd</P>]]></Content>

This is the xml and I want to get the text without img tags.

My XSLT code is just like this:

 <xsl:param name="text" select="."/> 
 <xsl:if test=". != ''"> 
  <xsl:choose> 
   <xsl:when test="contains($text, 'IMG')"> 
    <xsl:value-of select="substring-before($开发者_StackOverflow中文版text,'IMG')" 
                  disable-output-escaping="yes"/>
    <xsl:value-of select="substring-after($text,'border=0')" 
                  disable-output-escaping="yes"/>
   </xsl:when>
   <xsl:otherwise>
    <xsl:value-of select="." disable-output-escaping="yes"/>
   </xsl:otherwise>
  </xsl:choose>
 </xsl:if>


<xsl:value-of select="substring-before($text, '&lt;IMG')" />


If you wish to generate an <img/> tag, use <xsl:element name="img"/>. For instance:

<xsl:element name="img">
  <xsl:attribute name="src">
    <xsl:value-of select="$the_image_url"/>
  </xsl:attribute>
</xsl:element>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜