This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am being passed a text version of an URL address. This address prints on the worksheet. I need to change the code to activate the address on the worksheet when selected.
I have been trying to figure out where is the best location to make the change. Do I convert the address to an URL address in the java code and then display it or do I continue to pass the text version of the address to the xslt code and make the conversion there?
There's a lot of things I don't understand about your post.
First, what do you mean by "a text version of an URL address"? URLs don't have versions, they are just strings of characters. From your code it appears you have a string, so okay, you've got a URL in that string.
Second, what's this "worksheet" thing? It appears you're generating HTML, so is it a web page? And what do you mean by "convert the address to a URL address"? I'm guessing you might want the URL to appear as a hyperlink in your web page. If that's the case then just generate an <A> element with that URL as the href attribute. No conversion is going on there.
Joined: Nov 08, 2005
I am fairly new to xslt/html and I do not have all the lingo down. Yes I have the text of the url and I am wanting the url to appear as a hyperlink on the web page. I can now get the link to show up on the web page, but when I click on the link I get a "page cannot be displayed" error. I also tried to have the hyperlink open the site on a new page. I am receiving an error "Cannot find 'file:///CEV/IBM/wid6.0.1/JavaProject/ResultFormat/log/link'. Make sure the path or Internet addres is correct." I do not know where the path is coming from but the internet address is correct. From the IE I can open the page myself.
Is there something else that needs to be added?
Thanks for the help in advance
I added this
Element link = xmlDoc.createElement("link"); link.appendChild(xmlDoc.createTextNode(memberOfClientList.link)); client.appendChild(link);
Well, this is valid HTML and the URL it refers to is "link". It's interpreted as being relative to the base URL of your HTML document which I suppose must be something in the CEV/IBM/wid6.0.1/JavaProject/ResultFormat/log folder.
But you didn't want the URL to be the string constant "link" in your transformation, I don't think. You wanted it to be the value of a <link> element in your XML source document. To do that you use an Attribute Value Template: