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 May 15th, 2006, 07:25 AM
TPP TPP is offline
Authorized User
 
Join Date: Mar 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default Breaking line in method="text" mode

How do you break line in text output:

XML:
Code:
<?xml version="1.0" standalone="yes"?>
<N1>
  <N11>
    <N111>1</N111>
    <N222>2</N222>
    <N333>3</N333>
  </N11>
  <N22>
    <N111>6</N111>
    <N222>7</N222>
    <N333>8</N333>
  </N22>
</N1>
XSLT:
Code:
<?xml version="1.0" encoding="windows-1250"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="text" omit-xml-declaration="yes" encoding="ascii" />
<xsl:preserve-space elements="*"/>        


<xsl:template match="/">
<xsl:value-of select="N1/N11/N111"/>
<xsl:value-of select="N1/N11/N222"/>
<xsl:value-of select="N1/N11/N333"/>

<xsl:value-of select="N1/N22/N111"/>
<xsl:value-of select="N1/N22/N222"/>
<xsl:value-of select="N1/N22/N333"/>
</xsl:template>        

</xsl:stylesheet>
I get:

123456

...ok, but how do you break line after 3 to get:

123
456

Thanks for help, Peter.

 
Old May 15th, 2006, 07:35 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Use <xsl:text>#xa;</xsl:text>

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old May 15th, 2006, 07:51 AM
TPP TPP is offline
Authorized User
 
Join Date: Mar 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for a fast reply but it doesnt work, i get:
123#xa;678
 
Old May 15th, 2006, 08:22 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Should be ampersand-hash-x-a-semicolon. Don't know if I omitted the ampersand or if the forum software lost it.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old May 15th, 2006, 08:43 AM
TPP TPP is offline
Authorized User
 
Join Date: Mar 2006
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

...it works, thanks alot!






Similar Threads
Thread Thread Starter Forum Replies Last Post
gettting data from gridview in edit mode text cont mahboob_sabir ASP.NET 2.0 Professional 1 May 8th, 2007 02:05 AM
text on the same line Adam H-W CSS Cascading Style Sheets 2 February 19th, 2007 04:10 PM
Opening Text file in Binary mode for reading lawsoncobol Access VBA 1 August 3rd, 2006 04:01 AM
How to retrieve last selected text line in text bo garetho General .NET 1 May 3rd, 2005 09:17 PM
WriteLine Method with no New Line(?) busher Classic ASP Basics 1 January 13th, 2005 12:53 AM





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