tags:

views:

149

answers:

2

I've got an ASP.NET page that uses code similar to the following:

  <asp: repeater>
    <tr><td><b>LabelName</b></td><td><%# SomeMethod(parameter) %></td></tr>
    </asp: repeater>

These Labels are presently hardcoded, but there is an XML document that contains something like the following:

<label type="LabelA" name="LabelName" />>

So what I'd like to do is to use XSLT to transform the XML Document Labels into the HTML needed for the page, so that the label name from the XML document would be used. But obviously I'd have to contend with the <%# SomeMethod(parameter) %> used to pull other data from the database. My question is, what's the best way to do this?

Code deliberately obsfucated to protect the guilty.

+1  A: 

Use the repeater to generate an XML document with a list of child elements containing the value of SomeMethod(parameter)

Then, run that generated XML through an XSLT to generate the HTML you desire.

Mads Hansen
A: 

As it turns out, the XML wasn't well-formed and valid, so my question actually didn't have the XML really used by the application.

In the end, I'm rewriting the XML to be well-formed and valid, creating a Schema to enforce the XML rules, and using XSLT to transform that into HTML. I'll also Pass in the values from the MethodCall in the codebehind, so that the XSLT Transform works.

George Stocker