I’ve recently bought the Sitepoint book No Nonsense XML Web Development With PHP, and have tried to apply the knowledge to one of my ownsites but I’m getting tripped up.
I have successfully created a homepage to pull its content from an XML file but within this file I have <bodyCopy> tag that I need to contain a link but I can’t get the link to display.
eg:
<bodyCopy>Here is some text that includes <a href="test.htm">a link</a> and some more text</bodyCopy>
I can’t get the link to work, I’ve tried escaping the < to < and using CDATA. I’ve also tried using <link> and using XSLT to transform to <a href=“”> but I can’t get the XSLT to recognise the link.
Any suggestions, I’m sure its something obvious but I just can’t see it!
Many thanks in advance,
D
I am no expert but I do tinker with my php files on and off. Did you close the php portion of the file with the ending ?php> tag before you start your XML codes?
No, sorry I should have explained the error better. The text is still appearing before and after the <a href> eg if I set the XML as highlights in my original post. Then the text on screen displays as
‘Here is some text that includes and some more text’
Or if try to enclose it as CDATA or escape the < or > as < or > then it displays as
‘Here is some text that includes <a href=“test.htm”>a link</a> and some more text’
Which is sort of what I’d expect it to do but I don’t know what I need to do to get it to display as a link.
Wait - so you’re expecting this markup, which is not XHTML, HTML to be rendered as an HTML link? Huh? What’s the document type? Got a link to the page?