BizTalk Utilities Xselerator XSLT IDE


Forum main page

Most active member

Login page
Register
Log out

Search page


Information Online

View our event calendar
Add general event such as an upcoming software release or conference
View all birthdays

Public image gallery
Upload your images in your profile

Profile editing page
Subscription list page
Address book page

Member list page
View the most active member
User groups listing

Private message page

TopXML Discussion Forum TopXML Discussion Forum

Forums  Register  Login  My Profile  Inbox  Address Book  My Subscription  My Forums 

Photo Gallery  Member List  Search  Calendars  FAQ  Ticket List  Log Out

Help with removing <p></p> and <br /> tags

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [Ask XML questions here] >> XSLTalk (Programming) >> Help with removing <p></p> and <br /> tags Page: [1]
Login
Message << Older Topic   Newer Topic >>
Help with removing <p></p> and <br />... - 24 April 2008   
owen@bma

 

Posts: 1
Score: 0
Joined: 24 April 2008
Status: offline
Hi! Ive spent the last 2 days trying to find this out and cant get anywhere. I am consuming an rss feed on my site. The problem is that the feed has to many <p> tags and id like to remove them all.
the xsl sheet ;

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"  indent="yes"/>
<xsl:param name="TITLE"/>
<xsl:strip-space elements="description" />

<xsl:template match="rss">
<!-- Do not show channel image -->
<xsl:for-each select="channel/item">
  
   <xsl:if test="position() &lt; 6">  
  

   <strong><a href="{link}" target="_new"><xsl:value-of select="title"/></a></strong>

   <!-- only display markup for description if it's present -->
  <xsl:value-of  select="description" disable-output-escaping="yes"/>

 

   </xsl:if>
</xsl:for-each>
</xsl:template>

<xsl:template match="description">

   <xsl:value-of select="."/>
    

</xsl:template>

</xsl:stylesheet>


please help!!!!!!


Post #: 1
RE: Help with removing <p></p> and <br /... - 25 April 2008   
Jack_Kulas

 

Posts: 64
Score: 4
Joined: 2 July 2007
From: Jacksonville, FL, USA
Status: offline
owen@bma,

I ran your XSLT stylesheet on a sample XML feed (http://feeds.feedburner.com/DrMacrosXmlRants)
and the output looks pretty good except for lacking breaks between blog entries or items.

In the feed referenced above, the content of the <description> element contains adjacent <br><br> elements
as paragraph dividers.  Are you saying that the <description> element in your XML feed contains
multiple <p>'s that you want to remove?

It would help if you included a link to the XML feed page that you are trying to process so we could see what
you are trying to remove.

--Jack

(in reply to owen@bma)
Post #: 2
RE: Help with removing <p></p> and <br /... - 25 April 2008   
jkmyoung

 

Posts: 259
Score: 6
Joined: 14 September 2004
Status: offline
Judging purely from your xslt, you shouldn't be getting any <p> elements at all...

Generally, I would create a template like so:
<xsl:template match="p">
<xsl:apply-templates/>
</xsl:template>

which takes in p elements, and only processes their children without outputting anything.

(in reply to Jack_Kulas)
Post #: 3
Page:   [1]
All Forums >> [Ask XML questions here] >> XSLTalk (Programming) >> Help with removing <p></p> and <br /> tags Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts



Email TopXML

Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.094