[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] Can I grab text between two characters using XSL?
Subject: [xsl] Can I grab text between two characters using XSL? From: "Bryan M" <vanillaxtrakt@xxxxxxxxx> Date: Thu, 13 Sep 2007 17:10:41 -0400 |
i have some xml that's being created from multiple html pages by my CMS. for example: <page-xhtml> <p> <strong> <br/> RICHMOND, VA —July 16, 2007 — </strong> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent mauris lectus, interdum nec, consectetuer in, viverra id, enim. Vestibulum facilisis felis sed magna. <br/> I'm using XSL to format the page, and I want to pull the date from the page. Is there a way to just pull the text in between the — characters? the xml contains a lot of pages similar but not exact to the one above. i tried something like: <xsl:for-each select="system-page"> <!--Show the date--> <xsl:for-each select="page-xhtml//strong[contains(.,'Richmond') or contains(.,'RICHMOND')]"> <br/><xsl:value-of select="substring(.,16)"/> </xsl:for-each> but this only works for maybe half of the pages, because it seems all of the pages are formatted differently. the spacing seems to be different where it says "RICHMOND, VA" and so the date shows up like "uly 13, 2007" for some of the pages. In addition, even when this does work, it still returns the final — character, which I don't want. Some of the pages have another city listed altogether. It seems to me the easiest way would be to just pull the text between the — characters, but I honestly have no idea how to do this using XSLT 1.0 (the CMS uses Xalan). The last resort is to go change all of the HTML of the original pages, but this would not only consume a lot of time but it will not help me in the future when a new page is created with different spacing or some other problem. Any other ideas are more than welcome. Thanks.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] [XSL] XSL Browser Integra, Scott Trenda | Thread | Re: [xsl] Can I grab text between t, Alice Wei |
Re: [xsl] [XSL] XSL Browser Integra, Robert Koberg | Date | RE: [xsl] [XSL] XSL Browser Integra, Scott Trenda |
Month |