xsl-list
[Top] [All Lists]

Re: I don't get it... line breaks (sorry, I know this has been discussed many times)

2003-05-01 08:25:25

If you want a linebreak in the output (character 10) just put one in the
template:

    <xsl:template name="MAKE_HIDDEN_ATT">
     <xsl:text>&#10;</xsl:text>
     <input type="hidden">
            <xsl:attribute name="name">typ_<xsl:value-of
select="@name"/></xsl:attribute>
            <xsl:attribute name="value"><xsl:value-of
select="@type"/></xsl:attribute>
     </input>
    </xsl:template>


That could be more easily written


    <xsl:template name="MAKE_HIDDEN_ATT">
     <xsl:text>&#10;</xsl:text>
     <input type="hidden" name="typ_{(_at_)name}" value="{(_at_)type}"/>
    </xsl:template>


   I'm guessing that when you
  "apply-templates" that the loop which occurs naturally (and I call it a
  "natural" loop for lack of a better term) there in the match creates line
  breaks in the source.  Correct?

I have trouble parsing that but I suspect it is confused.
If you use apply-templates without a select attribute and get line
breaks in the output then most likely this is because you have applied
templates to the text nodes in the input that contain the line breaks,
and the default template for text nodes copies them to the result.

but by going  <xsl:for-each select="$xmTmplt/FLD"> you are just applying
things to FLD element nodes and skipping over the text nodes in teh
source, so they are not copied.

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

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