Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Transforming URL

 
Anil Vupputuri
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How can I get this URL working in XSL,

XML:




And corresponding XSL:

Option - 1:



Option - 2:



None of them are working. More over its trying to open relative to context like,



Any ideas to open as a absolute URL. Thanks.
 
Vallidevi Appana
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

you can use the following sample xsl code.......



This xsl worked fine if I replace "&" symbol with & amp; in xml file. I have used xalan to run this.
[ July 18, 2006: Message edited by: Vallidevi Appana ]
 
Paul Clapham
Sheriff
Pie
Posts: 20750
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am confused about the "it" that is "opening" a URL in that question.

Normally XSL is used to transform XML into HTML, as in your example. And it seems that the resulting HTML is processed by the "it" that you didn't describe. The XSL would not be doing that processing. So, what is "it"? And have you looked at the resulting HTML to see whether it looks correct?
 
Anil Vupputuri
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Vallidevi, I will try your code.

Sorry Paul for not being clear. What I meant was, the URL in resulting HTML is not giving correct URL.

For eg.,
Say, www.abc.com is the value for <link> in above XML.
The URL in resulting HTML page supposed to show www.abc.com but URL is shown as <a href="http://<app_server>/<app_context>/<b rel="nofollow">www.abc.com</b>" target="_blank">http://<app_server>/<app_context>/www.abc.com (relative to application context).

I am doing XML to HTML transformation by using Xalan XSLT Processor in Java.

What is the code we can use to fix the URL problem in XSL? Thanks.
 
Paul Clapham
Sheriff
Pie
Posts: 20750
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is something else you are not telling us. No XSLT processor will insert context information like that. This sounds more like something that a JSP tag library would do.
 
Anil Vupputuri
Ranch Hand
Posts: 527
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that's what happening. If you think you have a better idea, please shed some light on this.

Requirement is simple, how can I transform the following <link> tag in XML to a valid URL in resulting HTML by using XSL.

 
Paul Clapham
Sheriff
Pie
Posts: 20750
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Either of the two options in your original post will work fine.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic