问题
I'm using Apache XSL-FO to generate a PDF document from an XML using XSLT. In my XSL file I have an fo:block where I bring a URL and simply display it like this: xsl:value-of select="company_info/website"
My website always contains a valid URL for some company, starting with www.abc.com
It seems like that by default anything with a www is being recognized as a URL and becomes linkable. It does not seem like I can force the link of that company to load in a new window, as it always loads the page in the PDF window and that's not a desirable behavior. I am trying to find a way to disable to URL altogether so that it is not linkable and the only way I'm able to do it tight now is by inserting '-' on both ends of the URL: -www.abc.com- Is there a more elegant way to insert some kind of a special character that maybe is not visible?
回答1:
This is probably not something that can be fixed from the XSLT/XSL-FO side of things (except by inserting extra characters, as you have done). It is the PDF viewer that interprets certain strings as clickable links.
In Adobe Reader, you can disable automatic recognition of links by unchecking the "Create links from URLs" check box (Preferences dialog: General->Basic tools). Foxit Reader has this option too.
来源:https://stackoverflow.com/questions/6203613/need-to-disable-an-automatic-url-hyperlinking-with-xsl-fo-when-generating-a-pdf