Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening HTML link in a new window XLST 2

Status
Not open for further replies.

Chance1234

IS-IT--Management
Jul 25, 2001
7,871
US
Code:
	</TR>
	<TD>
		<xsl:element name="a">
		<xsl:attribute name="href">
		<xsl:value-of select="HPATH" /> 
		</xsl:attribute>
		<xsl:value-of select="HPATH" /> 
		</xsl:element>

		</TD>

Im using hte following method to create a hyerlink from my xml file, but having problems in getting the link to open up in a new window. Not sure which direction to move on this one.



Chance,

Filmmaker, taken gentleman and He tan e epi tas
 
[tt]<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="HPATH" />
</xsl:attribute>
[blue]<xsl:attribute name="target">
<xsl:value-of select="'_blank'" />
</xsl:attribute>[/blue]
<xsl:value-of select="HPATH" />
</xsl:element>
[/tt]
 
First off, you can shorten your code and make it more readable using curly brackets:
Code:
<a href="{HPATH}"> 
  <xsl:value-of select="HPATH" /> 
</a>
To open in new window:

Lazy, non-standards compliant way:
Code:
<a href="{HPATH}" target="_blank"> 
  <xsl:value-of select="HPATH" /> 
</a>
Javascript way:
Code:
<a href="{HPATH}" onclick="javascript: window.open('{HPATH}', '_blank')"> 
  <xsl:value-of select="HPATH" /> 
</a>
Or standards compliant way:


See for more info on window DOM object.

Jon

"I don't regret this, but I both rue and lament it.
 
cheers

Chance,

Filmmaker, taken gentleman and He tan e epi tas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top