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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xsl:attribute not working as desired...???

Status
Not open for further replies.

CubeE101

Programmer
Nov 19, 2002
1,492
US
It seems to not be working at all [sad]

Basically, I am in the process of trying to move my HTML pages that use XML as data to populate the tables... (which works fine)
To XML pages that use XSLT to transform and display the page...

The original method in the html page looks like this:
Code:
...
<xml src="xml/qbasic.xml" id="xmlfile" async="false" />
...
<table class="view" datasrc="#xmlfile">
<thead>
	<th>Title</th>
	<th>Author</th>
	<th>Description</th>
	<th>Screen Shot</th>
</thead>
<tbody>
<tr align="center">
	<td class="f"><a datafld="Link"><span datafld="Name" /></a></td>
	<td class="f"><a datafld="ALink"><span datafld="Auth" /></a></td>
	<td class="n"><span datafld="Desc" /></td>
	<td class="s"><img datafld="Pic" width="160" onmouseover="scrsht.src = this.src; scrsht.width=640" /></td>
</tr>
</tbody>
</table>
...

The Attempt in the XSLT to try to copy the functionality looks like this:
Code:
...
<table class="view">
<thead>
	<th>Title</th>
	<th>Author</th>
	<th>Description</th>
	<th>Screen Shot</th>
</thead>
<tbody>
<xsl:for-each select="Site/Files/File">
<tr>
	<td class="f">
	    <a>
	    	[b]<xsl:attribute name="href"><xsl:value-of select="Link"/></xsl:attribute>[/b]
	    	<xsl:value-of select="Name"/>
	    </a>
	</td>
	<td class="f">
	    <a>
	   	[b]<xsl:attribute name="href"><xsl:value-of select="ALink"/></xsl:attribute>[/b]
	    	<xsl:value-of select="Auth"/>
	    </a>
	</td>
	<td class="n"><xsl:value-of select="Desc"/></td>
	<td class="s">
	    <img width="160" onmouseover="scrsht.src = this.src; scrsht.width=640">
	    	[b]<xsl:attribute name="src"><xsl:value-of select="Pic"/></xsl:attribute>[/b]
	    </img>
	</td>
</tr>
</xsl:for-each>
</tbody>
</table>
...

In the XSLT method, the links don't apear, nor do the images...

Here are the resulting pages...

This page:

With xsl:

Sould look like:
(which used this XML
What's wrong with it???


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
oops... top got cut off...
--------------------------
I started out to find a way to use xml data for a link via an XSLT...

After doing a keyword search, and eventually finding this thread: thread426-663076 after several clicks...

I tried using the xsl:attribute that was suggested...


It seems to not be working at all [sad]
...



PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
anyone?


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
n/m...

I just need to use {xmltag} instead of xsl:attribute...

Code:
...
<table class="view">
<thead>
    <th>Title</th>
    <th>Author</th>
    <th>Description</th>
    <th>Screen Shot</th>
</thead>
<tbody>
<xsl:for-each select="Site/Files/File">
<tr>
    <td class="f">
        <a [b]href="{Link}"[/b]>
            <xsl:value-of select="Name"/>
        </a>
    </td>
    <td class="f">
        <a [b]href="{ALink}"[/b]>
            <xsl:value-of select="Auth"/>
        </a>
    </td>
    <td class="n"><xsl:value-of select="Desc"/></td>
    <td class="s">
        <img [b]src="{Pic}"[/b] width="160" onmouseover="scrsht.src = this.src; scrsht.width=640" />
    </td>
</tr>
</xsl:for-each>
</tbody>
</table>
...

that was simple enough...


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top