|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
xml with "almost" html inside
Hello,
I have an xml document with an element like this <ABSTRACT>some text.... Here is the link <a href="http://website.com">Website</a></ABSTRACT> I'm using xsl to display it. <xsl:for-each select="ABSTRACT"> <xsl:value-of select="."/> </xsl:for-each> How could i get the html tag working ? I know that if it was <a href="http://website.com">Website</a> inside the element it would work using xsl:copy-of but i have < > instead and can't do anything about it. Thanks for your help, Clement |
|
#2
|
|||
|
|||
|
Try this
Code:
<xsl:for-each select="ABSTRACT"> <xsl:value-of select="." disable-output-escaping="yes"/> </xsl:for-each> |
|
#3
|
||||
|
||||
|
If the only links you have are anchor tags, this should work. It might be able to be adapted to other tags or <a> tags with more than simple hrefs, but I'll leave that to you. There may be a simpler way to do this, but I am unfamiliar with it (if you find one that works, please post!). Also, this could be slow with large xml files. The test sample I used was fairly short.
With this xml (note addition of the <file> tags-there must be only one top-level element): PHP Code:
Use this xsl (warning long & confusing )PHP Code:
|
|
#4
|
|||
|
|||
|
I'm sorry. I tested again the one I posted and it didn't work. I can't remember in which cases it worked. If I can find it, I will write back.
|
|
#5
|
||||
|
||||
|
this worked for me, via php5 transform to html, as well as opening up in IE, for some reason it wouldnt work with firefox. . .?
test.xml PHP Code:
test.xsl PHP Code:
__________________
Teflon - The Black <desc>Mark This Up</desc> |
|
#6
|
|||
|
|||
|
ah! The xsl
utput piece, that's what was missing. |
|
#7
|
||||
|
||||
|
Thank you for your much cleaner solution-definately the way to go if the poster can. I had tried that but it would not render for me.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > xml with "almost" html inside |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|