xsl-list
[Top] [All Lists]

xsl href url in xml

2003-06-14 05:16:11
Hi, I believe I'm trying to do something similar. There is an xml document
with a url.
How can xsl be used to format the url so that when clicked it responds?

tia,
dk


<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
 <xsl:template match="/">
  <html>
   <body>
    <table border="1">
     <tr>
      <td>Trade #</td>
      <td>Buyer</td>
      <td>Seller</td>
      <td>Agent</td>
      <td>Trade Date</td>
      <td>Facilities (Name,Amount,Price)</td>
      <td>Docs</td>
     </tr>
     <xsl:for-each select="trades/trade">
      <tr>
       <td>
        Not in XML
       </td>
       <td>
        <xsl:value-of select="par"/>
       </td>
       <td>
        <xsl:value-of select="buyer"/>
       </td>
       <td>
        <xsl:value-of select="seller"/>
       </td>
       <td>
        <xsl:value-of select="tradedate"/>
       </td>
       <td>
        <xsl:for-each select="facilities">
         <table border="1">
          <tr>
           <td>
            <xsl:value-of select="name"/>
           </td>
           <td>
            <xsl:value-of select="amount"/>
           </td>
           <td>
            <xsl:value-of select="price"/>
           </td>
          </tr>
         </table>
        </xsl:for-each>
       </td>
       <td>
        <xsl:for-each select="repdocuments">
         <table border="1">
          <tr>
           <td>
            <xsl:value-of select="docdescrip"/>
           </td>
           <td>
           <xsl:template match="link">
                        <a href="javascript:window.open('{xsl:value-of
select="docpath"/}')"><xsl:apply-templates/></a>
                        </xsl:template>

           </td>
          </tr>
         </table>
        </xsl:for-each>
       </td>
      </tr>
     </xsl:for-each>
    </table>
   </body>
  </html>
 </xsl:template>
</xsl:stylesheet>


<?xml version="1.0" encoding="ISO-8859-1" ?>
<?xml-stylesheet type="text/xsl" href="try2.xsl"?>
<trades>
<trade>
        <par>8956</par>
        <buyer>Credit Suisse First Boston</buyer>
        <seller>Merrill Lynch</seller>
        <agent>JPMorgan Chase</agent>
        <tradedate>12/13/02</tradedate>
        <facilities>
                <name>Loan A</name>
                <amount>3,000,000,000</amount>
                <price>98.5</price>
        </facilities>
        <facilities>
                <name>Loan B</name>
                <amount>4,000,000,000</amount>
                <price>99.5</price>
        </facilities>
        <repdocuments>
                <docdescrip>AssignmentAcceptance</docdescrip>
                <docpath>http:\\8596\8596202AnAfunds.snp</docpath>
        </repdocuments>
        <repdocuments>
            <docdescrip>asdfsfad</docdescrip>
            <docpath>http:\\localhost\readinggroup\login.asp</docpath>


            </docpath>
        </repdocuments>
</trade>
<trade>
        <par>8956</par>
        <buyer>Credit Suisse First Boston</buyer>
        <seller>Merrill Lynch</seller>
        <agent>JPMorgan Chase</agent>
        <tradedate>12/13/02</tradedate>
        <facilities>
                <name>Loan A</name>
                <amount>3,000,000,000</amount>
                <price>98.5</price>
        </facilities>
        <facilities>
                <name>Loan B</name>
                <amount>4,000,000,000</amount>
                <price>99.5</price>
        </facilities>
</trade>
</trades>







-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com]On Behalf Of 
Américo
Albuquerque
Sent: Saturday, June 14, 2003 6:24 AM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: RE: [xsl] using the href attribute


Hi

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of
Kathy Burke
Sent: Friday, June 13, 2003 7:39 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] using the href attribute



I have a <link> element with an "href" attribute.

I apply this template and my html page works to open up the
link -- but in the same browser window.

      <xsl:template match="link">
      <a href="{(_at_)url}"><xsl:apply-templates/></a>
      </xsl:template>

Since I need the link to open into a new browser window...I
tried to do that, but I'm just not getting how the first way
works and why this next one doesn't:

      <xsl:template match="link">
        <a href="javascript:window(_dot_)open{(_at_)url}">

This is javascript.
If your url attribute points to www.someplace.com
Then your code would look like javascript:window.openwww.someplace.com

What you want is <a href="javascript:window.open('{(_at_)url}')">

Hope this helps you


      <xsl:apply-templates/></a>
      </xsl:template>

Thanks,

Kathy



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list





 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>