 |
| 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
|
|
|
|

February 26th, 2013, 05:11 AM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
<a target="_blank"> not working
I have a dynamic web page with an <a> where the href varies with the contents. I would like the <a> to open in a new tab instead of a new IE. I use <a href="......." target="_blank"/> to achieve this but got different results. If I use jsp to generate the html, the <a> open a new tab as I expected. But if I use servlet to dynamically generate xml and use xsl to transform it, the target="_blank" opens a new IE instead of a new tab. But when I save the xml and xsl into local folder and open them with IE, it opens new tab. Is there a better way to code the <a> so that it will open new tab all the times?
|
|

February 26th, 2013, 06:05 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
|
|
The output from your jsp and your servlet should be identical - i.e. if you do "View Source" in the browser they should be the same.
If they are not the same then fix that. If they are the same then it something the browser is doing - possibly to do with the relationship between the current page domain or url and the new page url.
|
|

February 27th, 2013, 02:37 AM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Sam, thanks for the reply. Looking back to my post it seems quite confusing. Allow me to rephase it:
(1). using jsp to generate html, target="_blank" in the resulting html leads to new tab, as expected.
(2). instead of jsp->html, using servlet to write xml to IE with xslt, target="_blank" in the xsl leads to new IE opened, not new tab.
(3). In 2, if I view the source in IE and save the xml together with the xsl, open the xml directly with IE, target="_blank" leads to new tab, as expected.
I don't know if there is any method to make (2) above also open new tab.
Last edited by senderj; February 27th, 2013 at 02:41 AM..
Reason: clarify
|
|

February 27th, 2013, 04:08 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
|
|
Without seeing the XSLT and XML I can't be sure, but this sounds like an issue with IE, and not with the XSLT. Not sure why your servlet served XML should behave differently when loaded locally, as that doesn't make much sense.
|
|

February 27th, 2013, 06:18 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
Let's start with a basic fact: the way IE renders an HTML document does not depend on what server-side techology you used to produce the document. So if two documents are rendered differently, they must be different. Or at the very least, they must be served with different HTTP headers. Start by looking for the differences (as Sam advised).
One possibility to explore is that the two documents have different base URIs which means they are referring to different CSS stylesheets.
One thing I notice is that you talk of your XSLT producing XML output. Why are you producing XML rather than HTML output? Is this anything to do with the problem?
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
|
|

February 27th, 2013, 08:49 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
|
|
I assumed that the servlet generated XML with an embedded XSLT (or stylesheet reference) for rendering in IE. If that's not the case then I don't know what is happening, and it needs explaining better.
|
|

February 28th, 2013, 12:28 AM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
<meta> in xsl
I have to apologie as I found that the problem has nothing to do with xslt, but depends on whether the page is in a frame or not. Sorry for wasting your time and appreciate your advises.
I have another question when trying to resolve my problem. Is there a way to control the <meta> generated from xslt, in particular the "charset" attribute? I tried to add <meta> into the xsl, but it generates two <meta> in the resulting html, one from xslt and one from mine.
|
|

February 28th, 2013, 12:28 AM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
<meta> in xsl
I have to apologie as I found that the problem has nothing to do with xslt, but depends on whether the page is in a frame or not. Sorry for wasting your time and appreciate your advises.
I have another question when trying to resolve my problem. Is there a way to control the <meta> generated from xslt, in particular the "charset" attribute? I tried to add <meta> into the xsl, but it generates two <meta> in the resulting html, one from xslt and one from mine.
|
|

February 28th, 2013, 04:52 AM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
Best to start a new thread when there is a new question.
You can control the charset in the generated meta element using the encoding property of xsl:output.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
|
|
 |