[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

AW: RE: RE: xsl:output method=xml

Subject: AW: RE: RE: xsl:output method=xml
From: Markus Abt <abt@xxxxxxxx>
Date: Thu, 31 Jul 2003 18:34:06 +0200
xsl output method xml
Hello Frank,

to get rid of the extra lines/whitespace, replace
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
by
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>


Regards,
Markus
__________________________
Markus Abt
Comet Computer GmbH
http://www.comet.de



----------
Von: 	Frank J. Buono
Gesendet: 	Donnerstag, 31. Juli 2003 15:04
An: 	xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Betreff: 	RE: RE: RE:  xsl:output method=xml


It IS nasty. :) HOwever, I'm a novice at this and I had to produce "<", ">", and "</".
This code gets me: "<name>text</name>". copy-of worked great; however, it gave
me a few extra lines that I couldn't seem to get rid of...

            <xsl:for-each select="child::*">
              <xsl:text disable-output-escaping="yes">&lt;</xsl:text>
              <xsl:value-of select="name()"/>
              <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
              <xsl:value-of select="text()"/>
              <xsl:text disable-output-escaping="yes">&lt;/</xsl:text>
              <xsl:value-of select="name()"/>
              <xsl:text disable-output-escaping="yes">&gt;</xsl:text>
            </xsl:for-each>

-----Original Message-----
From: cknell@xxxxxxxxxx [mailto:cknell@xxxxxxxxxx]
Sent: Wednesday, July 30, 2003 4:54 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: RE: RE:  xsl:output method=xml


That is uuuuuug-ly! There is almost never a reason to use disable-output-escaping. Trash everything inside the <xsl:for-each select="child::*"> element and replace it with this:

<xsl:element name="name()"><xsl:value-of select="text()"/></xsl:element>
-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     "Frank J. Buono" <Frank.Buono@xxxxxxxxxxxxxxxxxxxxxxx>
Sent:     Wed, 30 Jul 2003 16:06:09 -0400
To:       <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject:  RE: RE:  xsl:output method=xml


Thanks, Charles. This is what I ended up going with - kinda
brute force, but I'm a stylesheet novice:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
   <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
   <xsl:template match="ROWSET">
     <ROWSET>
       <xsl:for-each select="ROW">
       <xsl:sort select="value" data-type="number"/>
	 <ROW rownum="{position()}">
            <xsl:for-each select="child::*">
              <xsl:text disable-output-escaping="yes"><</xsl:text>
              <xsl:value-of select="name()"/>
              <xsl:text disable-output-escaping="yes">></xsl:text>
              <xsl:value-of select="text()"/>
              <xsl:text disable-output-escaping="yes"></</xsl:text>
              <xsl:value-of select="name()"/>
              <xsl:text disable-output-escaping="yes">></xsl:text>
            </xsl:for-each>
 	  </ROW>
	</xsl:for-each>
      </ROWSET>
    </xsl:template>
</xsl:stylesheet>

-----Original Message-----
From: cknell@xxxxxxxxxx [mailto:cknell@xxxxxxxxxx]
Sent: Wednesday, July 30, 2003 2:41 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE: RE:  xsl:output method=xml


Use the <xsl:copy-of> element. In the template below, change this line:
<ROW rownum="{@rownum}"><value><xsl:value-of select="." /></value></ROW>

to:
<xsl:copy-of select="." />
-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     "Frank J. Buono" <Frank.Buono@xxxxxxxxxxxxxxxxxxxxxxx>
Sent:     Wed, 30 Jul 2003 13:42:46 -0400
To:       <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject:  RE:  xsl:output method=xml


Thanks, Charles and Mukul. That code works great!
I was under the mistaken impression that "output method=xml"
would give me more XML tags of output.

I ultimately need to have my output XML look exactly
the same as my input XML but with the rows sorted column. Each
row could have several columns.

Is there a generic stylesheet example available that simply
passes everything through?

Thanks.

frank

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="xml" indent="yes" encoding="UTF-8" />
  <xsl:template match="/">
    <xsl:apply-templates />
  </xsl:template>

  <xsl:template match="ROWSET">
    <ROWSET>
    <xsl:for-each select="ROW">
      <xsl:sort select="value" data-type="number" order="ascending" />
      <ROW rownum="{@rownum}"><value><xsl:value-of select="." /></value></ROW>
    </xsl:for-each>
    </ROWSET>
  </xsl:template>
</xsl:stylesheet>
-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     "Frank J. Buono" <Frank.Buono@xxxxxxxxxxxxxxxxxxxxxxx>
Sent:     Wed, 30 Jul 2003 10:02:07 -0400
To:       <XSL-List@xxxxxxxxxxxxxxxxxxxxxx>
Subject:   xsl:output method="xml"


I've seen a lot of examples of outputing in HTML; however,
I'd like to sort on "value" and output in XML - see input and
desired output XML below.

Can anybody help with what my stylesheet should look like?

Thanks.

Frank
p.s., I'll be doing this within java code.

****Input:
<ROWSET>
   <ROW rownum="1">
      <value>3</value>
   </ROW>
   <ROW rownum="2">
      <value>1</value>
   </ROW>
   <ROW rownum="3">
      <value>2</value>
   </ROW>
</ROWSET>

*****Output:
<ROWSET>
   <ROW rownum="1">
      <value>1</value>
   </ROW>
   <ROW rownum="2">
      <value>2</value>
   </ROW>
   <ROW rownum="3">
      <value>3</value>
   </ROW>
</ROWSET>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list





 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.