Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 6th, 2006, 08:22 AM
Registered User
 
Join Date: Feb 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Html to XML

Hey,

I'm having a problem with my XSLT.
Here's the html section:

Code:
<p>
this is a test message
<a href="nextpage.html">Next page</a>
end of message
</p>
Required XML output
Code:
<text>
this is a test message
<link des="nextpage.html">Next page</link>
end of message
</text>
I can't seem to pull the value of the p element properly. it returns
Code:
"this is a test message Next page end of message"
but i want the <link> element in place of the Next page words.

Any ideas?

Stevoie

 
Old February 6th, 2006, 10:11 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

It's always difficult to find bugs in people's code when they don't show you the code, but as a completely blind guess, you're using xsl:value-of instead of xsl:copy-of.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old February 6th, 2006, 12:37 PM
Registered User
 
Join Date: Feb 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

unfortunately thats not exactly what i want. your right i was using xsl:value-of to pull out the value. but when i switch to xsl:copy-of, it just prints out the value of the <p> element with the <a href...></a> element embedded in it. i need to replace the <a href...></a> element with the <link...></link> element.

i can do it if the html was written as:
Code:
<p>
<text>this is a test message</text>
<a href="nextpage.html">Next page</a>
<text>end of message</text>
</p>
it's because the <a href..> is embedded inside the value of <p> that is causing me problems.
any ideas?





Similar Threads
Thread Thread Starter Forum Replies Last Post
xml to html with xsl boblavinsky XSLT 4 January 5th, 2007 05:30 AM
Is XML supports transformation of HTML to XML? zeeonline XSLT 1 July 28th, 2006 05:13 PM
About HTML and XML sachinkumar XML 1 June 28th, 2005 10:30 AM
XML to HTML shoei78 XSLT 2 June 24th, 2003 08:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.