 |
| 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
|
|
|
|

September 20th, 2007, 11:27 AM
|
|
Authorized User
|
|
Join Date: Feb 2007
Posts: 51
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
escaping < char
how do I escape < in my xslt? thanks
|
|

September 20th, 2007, 11:37 AM
|
|
Authorized User
|
|
Join Date: Feb 2007
Posts: 51
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
In fact, using:
<xsl:text disable-output-escaping="yes"><</xsl:text>
I still get wellformedness error.. Any help is appreciated. Thanks
|
|

September 20th, 2007, 11:41 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
|
|
Try \<
|
|

September 20th, 2007, 11:45 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
|
|
XML won't accept < other than as tag construct or inside a CDATA section. Use one of the built in entity references, & l t ; (without the spaces).
--
Joe ( Microsoft MVP - XML)
|
|

September 20th, 2007, 11:49 AM
|
|
Authorized User
|
|
Join Date: Feb 2007
Posts: 51
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
joe, by "Use one of the built in entity references, & l t ; (without the spaces).", I don't know what you mean. Could you just give me a code example? Thank you
|
|

September 20th, 2007, 12:22 PM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
< in any XML document (including XSLT) is written <. In case that doesn't show up in the forum it is four characters, "&", "l", "t", ";".
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|
|

September 20th, 2007, 01:00 PM
|
|
Authorized User
|
|
Join Date: Feb 2007
Posts: 51
Thanks: 3
Thanked 0 Times in 0 Posts
|
|
Ahh. thank you. this is better, but still not completely solving my problem. In the output, I need to see the "<" and ">" characters, but instead are seeing "<" and ">".
Am I still missing something here? Thank you so far!
|
|

September 20th, 2007, 01:13 PM
|
 |
Wrox Author
|
|
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
|
|
Why do you need to see < and > in the output? Is it perhaps because you are trying to generate tags "by hand"? That's not the right thing to do in XSLT - if you want to generate an element node, use instructions like xsl:element.
Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
|
|

September 20th, 2007, 07:30 PM
|
|
Registered User
|
|
Join Date: Sep 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I have a similiar need but it is to output the following 5 characters: #10; to the result stream. I am writing a SpreadsheetML xslt that needs to put multiple strings in an Excel Cell and have them appear on separate lines within the cell. Here is what Excel generates when I put 3 lines of text to a cell and then save the worksheet as xml.
<Cell ss:StyleID="s62">
<Data ss:Type="String">ron#10;was #10;here#10;</Data>
</Cell>
I'm trying to do the same thing with xslt.
My real code is:
<Cell ss:StyleID="{$rowStyle}">
<Data ss:Type="String">
<xsl:for-each select="msxml:node-set($splitString)/token"> <xsl:value-of select="."/>#10;
</xsl:for-each>
</Data>
</Cell>
Instead of getting #10; in the output I get &#10;
Is there a way that I can get what I need or am I trying to do something that can't be done.
Thanks for the help
|
|

September 20th, 2007, 07:37 PM
|
|
Registered User
|
|
Join Date: Sep 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Just a note on my previous post. In all the places where I entered 5 characters (an ampersand plus #10;) the ampersand disappeared. Now I'm not even sure how to express what the problem is except that where you see #10; I keyed in ampersand#10;
|
|
 |