Jump to content

senderj

Members
  • Content Count

    3
  • Joined

  • Last visited

Posts posted by senderj

  1. There may be a better way, but this one seems to work. If xml is:

    <mydata>  <datacount>	<data>data1</data>	<count>count1</count>  </datacount>  <datacount>	<data>data2</data>	<count>count2</count>  </datacount>  <datacount>	<data>data3</data>	<count>count3</count>  <datacount>	<data>data4</data>	<count>count4</count>  </datacount><mydata>

    use this xsl:

    <?xml version="1.0" encoding="ISO-8859-1"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="html" version="4.0" encoding="UTF-8" indent="yes"/><xsl:template match="/"><html><body><table border="1"><tr>  <th>Column1</th>  <th>Column2</th>  <th>Column1</th>  <th>Column2</th></tr><xsl:for-each select="mydata/datacount"><xsl:if test="position() mod 2 = 1"><tr>  <td><xsl:value-of select="data"/></td>  <td><xsl:value-of select="count"/></td>  <td><xsl:value-of select="following::data"/></td>  <td><xsl:value-of select="following::count"/></td></tr></xsl:if></xsl:for-each></table></body></html></xsl:template></xsl:stylesheet>

  2. 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. So I use <a href="......." target="_blank"/> to achieve this but not always work: (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 in same folder, 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. Please help.

×
×
  • Create New...