[xsl] Re: XSL Line Breaks/Indentation - Please !!!

Subject: [xsl] Re: XSL Line Breaks/Indentation - Please !!!
From: "Steve Muench" <Steve.Muench@xxxxxxxxxx>
Date: Thu, 26 Apr 2001 22:28:14 -0700
| And I use the following XSL to convert this to another XML:
| <?xml version="1.0"?>
| <xsl:stylesheet version="1.0"
|   <xsl:text disable-output-escaping="yes">&lt;PRODUCT
|   <xsl:value-of select="$attribValue"/>
|   <xsl:text disable-output-escaping="yes">"&gt;</xsl:text>

A stylesheet like this might work better for you:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
 <xsl:output indent="yes"/>
 <xsl:template match="PRODUCTS">
   <xsl:apply-templates select="PRODUCT"/>
 <xsl:template match="PRODUCT">
  <xsl:variable name="lang" select="@xml:lang"/>
  <PRODUCT xml:lang="{$lang}">
    <xsl:copy-of select="PRODUCTID"/>
    <xsl:copy-of select="PRODUCTNAME"/>
    <xsl:copy-of select="MANUFACTURERPRODUCTNAME"/>
    <xsl:copy-of select="BRANDNAME"/>
    <xsl:for-each select="EXTRAID">
      <PRODUCTID QUALIFIER="{following-sibling::*}">
    <xsl:value-of select="."/>
  <xsl:for-each select="KEYWORD">
   <KEYWORD xml:lang="{$lang}">
     <xsl:value-of select="."/>

When you find yourself using disable-output-escaping="yes"
to construct element markup like angle-brackets, then it should
be a sign that there's probably an easier way since XSLT is
designed to make it really easy to construct elements and
attributes in the output. I'm not exactly sure if the
following-sibling::* is what you want, but this cleaned up version
of your stylesheet should get you going in the right direction.
Steve Muench, Lead XML Evangelist & Consulting Product Manager
BC4J & XSQL Servlet Development Teams, Oracle Rep to XSL WG
Author "Building Oracle XML Applications", O'Reilly

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

Current Thread