jQuery in Action, 2nd edition*
The moose likes XML and Related Technologies and the fly likes Transforming URL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Transforming URL" Watch "Transforming URL" New topic
Author

Transforming URL

Anil Vupputuri
Ranch Hand

Joined: Oct 31, 2000
Posts: 527
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.


SCJP 1.5, SCEA, ICED (287,484,486)
Vallidevi Appana
Greenhorn

Joined: Jun 30, 2006
Posts: 25
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
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

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

Joined: Oct 31, 2000
Posts: 527
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
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

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

Joined: Oct 31, 2000
Posts: 527
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
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Either of the two options in your original post will work fine.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Transforming URL