[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: specifying a target for a hyperlink
Hi Rach, > hopefully someone will be able to help me solve this problem. I have > hyperlinks in my xml document that I am applying xsl to and then > opening them in a html page. This is all working find, but I want > the new page (as a result of clicking the hyperlink to open in a new > page. I can't get the target element of the hyperlink working > properly. Currently I have the target as an attribute of the > hyper;ink. I don't know if this is correct! maybe it would be easier > if I contained the information in a separate tag? I have included > snippets of the xml and xsl below. the information for calling the > files is all in an asp file. For a start, you should be using XSLT rather than the strange dialect that's used in old versions of MSXML. Have a look at the MSXML FAQ at http://www.netcrucible.com/xslt/msxml-faq.htm for a description. Secondly, you shouldn't be using the xmlns attribute to do anything aside from setting the default namespace of an element. This: > <url xmlns="_blank"> http://www.vbxml.com/downloads/#software</url> Fixes the default namespace to the namespace URI '_blank' (which I think it not a legal namespace URI). Instead, use a different name, like 'target' for the attribute: <url target="_blank">http://www.vbxml.com/downloads/#software</url> Finally, in order to aim an HTML link at another target, you need to have a 'target' attribute on the HTML 'a' element. If you always want it to open in another window, you could use: <A HREF="{url}" TARGET="_blank"><xsl:value-of select="url" /></A> If you want to use the 'target' attribute on the 'url' element to determine the location, then you could use an attribute value template to fix it: <A HREF="{url}" TARGET="{url/@target}"> <xsl:value-of select="url" /> </A> Note that this is just a shortened syntax from the spelt-out version, which uses xsl:attribute: <A> <xsl:attribute name="HREF"> <xsl:value-of select="url" /> </xsl:attribute> <xsl:attribute name="TARGET"> <xsl:value-of select="url/@target" /> </xsl:attribute> <xsl:value-of select="url" /> </A> I hope that helps, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|