xml editor

Supported platforms

Compatible with Windows7 & Mac OS X Snow Leopard

Ready for data server software
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

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


Subject: Re: [xsl] I don't get it... line breaks (sorry, I know this has been discussed many times)
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 1 May 2003 16:25:25 +0100

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_{@name}" value="{@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



Current Thread
XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2011 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>®XML Editor