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

Re: tag with one blank body

Subject: Re: tag with one blank body
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 05 Jan 2010 07:41:55 -0500
Re:  tag with one blank body
At 2010-01-05 13:35 +0100, Bartolomeo Nicolotti wrote:
I've a very stupid problem, but I've tried two ways without finding a
solution.

Your second one works for me ... your first one is missing something.


I've the need to generate in the output xml this tag with exactly one
space inside the body:

<QCat> </QCat>

I've tried this in the xstl:

<QCat><!-- DataType: Alphanumeric
                             Length: 2
                             Left justified. Blank fill if not used
                             --><xsl:value-of select=' '/></QCat>

What you have above is an empty expression, not an expression for a string of a single space. That would be:


select="' '"

or:

select='" "'

and this

<QCat><!-- DataType: Alphanumeric
                             Length: 2
                             Left justified. Blank fill if not used
                             --><xsl:text> </xsl:text></QCat>

That should work without problem, and it does with my processor.


but both give

<QCat></QCat>

Any hints?

How are you determining QCat is empty? Are you looking at the file in its raw form, or are you perhaps opening the file in an XML editor and the editor is for some reason thinking the element is empty and presenting it as such?


I hope this helps.

. . . . . . . Ken

T:\ftemp>xslt bartholomeo.xsl bartholomeo.xsl con
<?xml version="1.0" encoding="utf-8"?><result><QCat> </QCat>

and this

<QCat> </QCat></result>
T:\ftemp>type bartholomeo.xsl
<?xml version="1.0" encoding="US-ASCII"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="2.0">

<xsl:template match="/">
<result>
<QCat><!-- DataType: Alphanumeric
                             Length: 2
                             Left justified. Blank fill if not used
                             --><xsl:value-of select="' '"/></QCat>

and this

<QCat><!-- DataType: Alphanumeric
                             Length: 2
                             Left justified. Blank fill if not used
                             --><xsl:text> </xsl:text></QCat>
</result>
</xsl:template>
</xsl:stylesheet>
T:\ftemp>

--
UBL and Code List training:      Copenhagen, Denmark 2010-02-08/10
XSLT/XQuery/XPath training after http://XMLPrague.cz 2010-03-15/19
XSLT/XQuery/XPath training:   San Carlos, California 2010-04-26/30
Vote for your XML training:   http://www.CraneSoftwrights.com/s/i/
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/s/
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson:    http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview:  http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Male Cancer Awareness Nov'07  http://www.CraneSoftwrights.com/s/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

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.