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!

XML+XSL challege for Experts

Status
Not open for further replies.

pmartin2000

Programmer
Oct 6, 2003
1
US
I have been using XML+XSL on and off for few years. I came accross following challenge:

I have following simplified code which is meant to display variable-width images within the table (based on [wantedWidth] from the XML document):

<xml id='myData'>
<rowset>
<row>
<wantedWidth>
200
</wantedWidth>
</row>
<row>
<wantedWidth>
100
</wantedWidth>
</row>
</rowset>
</xml>

<xml id=&quot;myDataFormat&quot;>
<rowset>
<xsl:for-each select=&quot;row&quot; xmlns:xsl=&quot; <row>
<wantedWidth>
<xsl:value-of select=&quot;wantedWidth&quot; />
</wantedWidth>
</row>
</xsl:for-each>
</rowset>
</xml>

<table id=&quot;myDataTable&quot; datasrc=&quot;#myData&quot; border=&quot;1&quot;>
<thead>
<th>Image:</th>
</thead>
<tr>
<td>
<span datafld=&quot;wantedWidth&quot;></span>
<img src=&quot;bar.gif&quot; height=&quot;10&quot; border=1>
<xsl:attribute name=&quot;width&quot;>
<xsl:value-of select=&quot;wantedWidth&quot;/>
</xsl:attribute>
</img>
</td>
</tr>
</table>

<script>
var xmldso = document.all(&quot;myData&quot;);
var xsltTree = document.all(&quot;myDataFormat&quot;);
xmldso.documentElement.transformNodeToObject(xsltTree.documentElement, xmldso.XMLDocument);
</script>


The problem is that I'm trying to use XSL within datasrc-bound table ... which in itself is not XSL-interpreted. And binding <img> through [datafld] only changes the image's SRC property.

The challenge is to get this working without switching over to just using XSL and dropping the table-bounding.

Any ideas?

Thanks
Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top