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

Help with XSL sort -vs- XSL Attribute please?

Status
Not open for further replies.

spiel2001

Programmer
Nov 1, 2001
39
US
I have a web site heavily dependent on XML/XSL in which I am using both xsl:sort and xsl:attribute. I am having a conflict and can't seem to resolve it.

On the one hand, I can use...

<xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;
and make use of the xsl:attribute tag as follows...

<input type=&quot;text&quot; name=&quot;ALIAS&quot; size=&quot;15&quot; maxlength=&quot;15&quot;>
<xsl:attribute name=&quot;value&quot;>
<xsl:value-of select=&quot;/ProfileView/Member/Alias/@value&quot;/>
</xsl:attribute>
</input>

However, I can not seem to get the xsl:sort tag to work using this XMLNS -- for example, the following code fragment results in a &quot;xsl:sort tag not allowed here&quot; error in IE 6...

<xsl:for-each select=&quot;/ProfileView/Board&quot;>
<xsl:apply-templates select=&quot;.&quot;>
<xsl:sort select=&quot;dbDefs/Name/@value&quot;/>
</xsl:apply-templates>
</xsl:for-each>

Conversely, I can use the statement...

<xsl:stylesheet version=&quot;1.0&quot; xmlns:xsl=&quot;
and the xsl:sort tag will work, but all of my xsl:attribute calls as shown above result in a &quot;invalid xsl:attribute value&quot; message in IE 6

It seems which ever name space I am using, I am losing one feature or the other.

Can anyone point out where I might be going wrong in this?

TIA
 
the xmlns:xsl=&quot; XSL/Transform&quot; should definately be the namespace to use and should support the <xsl:attribute> tag.

the way you have used the <xsl:attribute> looks fine too. the problem may be somewhere else and msxml is just reporting the error in the wrong place. try stripping the xsl down to the bare minimum and see if the problem is still there.
 
MrTom --

Thanks for the reply. I helps to know that I am on the right track. I'll rip it apart and see what I find. If I can identify the source of the problem, I'll post it here in the hopes it will help someone else out.

Again, thank youl.
 
Doh! I found it...

I had two xsl:attribute statements in the source written as <xsl:attribute name=&quot;selected&quot; value=&quot;1&quot;/> which seemed to work with the name space but was unacceptable with the name space.

Changed it to <xsl:attribute name=&quot;selected&quot;>1</xsl:attribute> and it worked.

Go figure.

Again, thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top