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!

VB generates XML?

Status
Not open for further replies.

slatet

Programmer
Sep 11, 2003
116
US
I hope I am in the correct forum for this. We have code from another company that we need to modify. We are not very good at XML so any help would be appreciated.

The page start out with this:
Response.Write(&quot;<?xml version=&quot;&quot;1.0&quot;&quot;?>&quot; & vbCrLf)
Response.Write(&quot;<?xml:stylesheet type=&quot;&quot;text/xsl&quot;&quot; href=&quot;&quot;XSL/TaskViewXSL.asp&quot;&quot;?>&quot; & vbCrLf)


this is why I post it to this forum. Later the values are loaded like this:

Response.Write(sTabString & &quot;<task taskid=&quot; & Chr(34) & rsOutput(&quot;TaskID&quot;).Value & Chr(34))
Response.Write(&quot; tasktype=&quot; & Chr(34) & rsOutput(&quot;TaskType&quot;).Value & Chr(34))
Response.Write(&quot; routetype=&quot; & Chr(34) & rsOutput(&quot;TaskRouteType&quot;).Value & Chr(34))
Response.Write(&quot; parent=&quot; & Chr(34) & rsOutput(&quot;TaskParent&quot;).Value & Chr(34))
Response.Write(&quot; subject=&quot; & Chr(34) & Server.HtmlEncode(rsOutput(&quot;TaskSubject&quot;).Value) & Chr(34))
.............

All we are trying to do is bold the output task name under a certain condition. Does anyone understand and know how to do this? Or any good descriptions on what this is doing exactly would help too.
 
You need to look at the XSL Stylesheet - XSL/TaskViewXSL.asp - as that will be where the raw XML is converted to HTML for display.

XSL is pretty daunting if you've never seen it before but if you could post it up here I or somebody else will be able to help you.

 
I've made some progress. I have added something to the XSL file, but the page does not completely load. Perhaps someone can see the problem? I am trying to determine if the variable taskRead which is an attribute is true or false an bolding the word depending on the result. And that is it.

Sorry if the indents are crazy, I tried to fix them. Thanks

<xsl:template match=&quot;task&quot;>

<div class=&quot;item&quot;>
<xsl:attribute name = &quot;id&quot;>tid<xsl:value-of select=&quot;@taskid&quot;/></xsl:attribute>
<a>
<xsl:attribute name=&quot;taskid&quot;>
<xsl:value-of select=&quot;@taskid&quot;/>
</xsl:attribute>
<xsl:attribute name=&quot;taskRead&quot;>
<xsl:value-of select=&quot;@taskRead&quot;/>
</xsl:attribute>
..more in here


<xsl:choose>
<xsl:when test=&quot;string-length(@subject)&gt;40&quot;>

<xsl:when test=&quot;@taskRead='False'&quot;>
<span style=&quot;font-weight: bold;&quot;>
<xsl:value-of select=&quot;substring @subject,0,37)&quot;/>...
</span>
</xsl:when>
<xsl:eek:therwise>
<xsl:value-of select=&quot;substring(@subject,0,37)&quot;/>...
</xsl:eek:therwise>
</xsl:when>
<xsl:eek:therwise>
<xsl:when test=&quot;@taskRead='False'&quot;>
<span style=&quot;font-weight: bold;&quot;>
<xsl:value-of select=&quot;@subject&quot;/>
</span>
</xsl:when>
<xsl:eek:therwise>
<xsl:value-of select=&quot;@subject&quot;/>
</xsl:eek:therwise>
</xsl:eek:therwise>
</xsl:choose>
 
You might check if &quot;false&quot; instead of &quot;False&quot; works: it is not a boolean operator, but a case-sensitive string-value.

Also, &quot;substring @subject,0,37)&quot;
should be &quot;substring(@subject,0,37)&quot;
(Typo?)

Hope it helps...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top