I've been playing around with it and there's something I can't figure out.
The XML is based of an RSS Feed. Here's a example of XML I am trying to play with.
<item>
<title>Dinner at Chilis</title>
<link></link>
<description>
[!CDATA[<div><b>Location:</b> Chilis </div>
<div><b>Start Time:</b> 4/21/2010</div>
<div><b>Description:</b> Dinner at Chilis </div>]]>
</description>
</item>
Here's a part of the XSL I've been playing around.
<xsl:template match="item">
<xsl:value-of select="title"/>
<xsl:value-of disable-output-escaping="yes" select="substring-before(substring-after(description, ']]'), '[CDATA[') "/>
</xsl:template>
I'm not sure why it's not displaying the string.
My previous code was like this:
<xsl:template match="item">
<xsl:value-of select="title"/>
<xsl:value-of disable-output-escaping="yes" select="description"/>
</xsl:template>
It displays, but I won't have control on how to select the specific text in the description tag.
It's something I want to learn how to do it. I'm still a beginner in XSL so my apologies for being a newbie.
EDIT*
Ok. I got it.
It displays only the first line though. lol. Here's the code I have right now.
<xsl:template match="item">
<xsl:value-of select="title"/>
<xsl:value-of disable-output-escaping="yes" select="substring-before(substring-after(description, '<div>'), '</div>') "/>
</xsl:template>
So far so good. I'll play around a bit more.
No comments:
Post a Comment