Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 10th, 2008, 08:24 AM
Friend of Wrox
Join Date: Jan 2007
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
Default .Net2 xslt does not like the &lt; "<" - &gt; ">"

Hi, I need help please.

Update system to to new version & moved on to .Net2
But now my code that worked in my .Net1 xslt does not work.

.Net1 fine:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:asp="remove" xmlns:igchart="remove" xmlns:igsch="remove">
&lt;td class='rowDet' id="td_<xsl:value-of select='@name' />"&gt;
.Net2 don't work:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:asp="remove" xmlns:igchart="remove" xmlns:igsch="remove" xmlns:igtxt="remove">
&lt;td class='rowDet' id="td_<xsl:value-of select='@name' />"&gt;

I had to change it back to: <td class='rowDet'>

Is there a new code for the "<" ">"?

Please Assist!


Old October 10th, 2008, 08:39 AM
Friend of Wrox
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts

What exactly do you want to achieve?
It is not clear where exactly you have those entity references like &lt; and why you think you need them.
It is also not clear what error message exactly you get. Please tell us exactly what you have tried and which error message exactly you get.

  Martin Honnen
  Microsoft MVP - XML
Old October 10th, 2008, 08:40 AM
samjudson's Avatar
Friend of Wrox
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts

Creating elements in the output XML (or tat least trying to) using &lt; and &gt; is generally a 'bad thing' due to the way different processor handle things.

Try doing this instead:

<td class="rowDet">
    <xsl:attribute name="id">td_<xsl:value-of select="@name"/></xsl:attribute>
/- Sam Judson : Wrox Technical Editor -/
Old October 10th, 2008, 10:03 AM
mhkay's Avatar
Wrox Author
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts

Neither text nodes (&lt;) nor instructions like xsl:value-of are allowed as direct children of xsl:stylesheet, so neither of these should work. But perhaps you left out some levels of structure. But I would need to see those levels to see whether your your code is valid XSLT or not.

Whether valid or not, it's not good coding style. You want to be using attribute value templates:

<td class="rowdet" id="td_{@name}">

Michael Kay
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference
Old October 11th, 2008, 04:40 AM
Friend of Wrox
Join Date: Jan 2007
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts

Hi All, Thank You very much.

I don't know xml at all, all I did to the xslt file before the upgrade was to edit/add some code.
I needed to get the id of the description so that on mouseover my object i want to change the background color of the TD.
This worked:<xsl:when test="Attributes[ @name='visible'] != 'False'">
        <td width='15%' align='right' class='rowDet'> <xsl:attribute name="id">td_<xsl:value-of select='@name' /></xsl:attribute>

Thank You all for your kindness & knowledge!


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 8: <asp:image> inside <a> & ext.CSS (pg. 274) epc BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 July 12th, 2008 04:37 AM
Need "&" and "<!-- -->" in the output sunrain XSLT 2 January 19th, 2007 05:29 PM
<style> tags in a <body> vs. <div> bcat BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 March 27th, 2005 08:50 AM
<marquee><b>About CHAT App. in PHP4</b></marquee> Ramkrishna PHP How-To 1 September 11th, 2004 07:01 AM
XML from a DB recordset (removal of &lt;&gt;) Thodoris XML 3 July 13th, 2004 12:28 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.