This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
regarding newline
- From: subbu at boltblue dot com
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Thu, 11 Jul 2002 11:14:40 +0100
- Subject: [xsl] regarding newline
- References: <9723092BA4DBD111816D0000F6B093610C27E9E5@imsuklndsx1.lnd.uk.imshealth.com> <00ba01c21dc1$c4e01a70$1802893e@ROSEBUD>
- Reply-to: xsl-list at lists dot mulberrytech dot com
hi,
I have a problem with the new lines.
What i am doing is, I have formed a DTD file thaz called entityreference.dtd
( which i will make use in the xsl through doctype)
<!DOCTYPE xsl:stylesheet SYSTEM "D:\xsl-exp\characterEntities\entityref.dtd">
the following is the contents of this file
<!ENTITY space " "> <!-- space -->
<!ENTITY quots """> <!-- double quotes-->
<!ENTITY newline "
"> <!--new line--> etc.....
.
.
.
.
I did this so that i may just refer to them in my XSL like
<xsl:value-of select = "@id"/> &space; <xsl:value-of select = "."/>
to get me a space between id and value
just to replace the code
<xsl:value-of select = "@id"/><xsl:text> </xsl:text><xsl:value-of select
= "."/>
this works fine..
I now want to use the newline character.
so instead of using the <xsl:text>
</xsl:text>
i declare the entity in the dtd..
<!ENTITY newline "
"> <!--new line-->
and try to do things like
<xsl:value-of select = "@id"/> &newline;<xsl:value-of select = "."/>
nothin seems to happen..
I was going through the Michlael Kay's XSLT Reference and found that
"XML parser will normalize the attribute values.A tab or a newline is allways
replaced by a single space unless it is written as a character reference such
as <<	>> or <<&#A>> "
I am not sure how to aceive what i want
I am how ever satisfied to use
<xsl:value-of select = "@id"/> <xsl:text>
</xsl:text><xsl:value-of select
= "."/>
Which produces a newline between id and value..
Any ideas regarding what i should do ??
Wheather or not i am in the right track to declare entities in the dtd file and
refer them in the XSL ..
The following is a snipp of the XSL code
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet SYSTEM "D:\characterEntities\entityref.dtd">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" omit-xml-declaration="yes"/>
<xsl:template match="/">
<xsl:for-each select="centers/center">
<!-- space between id and value -->
<xsl:value-of select="@id"/>&space;<xsl:value-of select ="."/>
<!-- the above works same as coding <xsl:value-of
select="@id"/><xsl:text> </xsl:text><xsl:value-of select ="."/>-->
<!-- newline between id and value -->
<xsl:value-of select="@id"/>&newline;<xsl:value-of select ="."/>
<!-- the above does not produce any newline ,( newline defined in dtd as
<!ENTITY newline "
"> <!--new line--> ) but instruction like
<xsl:value-of select="@id"/><xsl:text>
</xsl:text><xsl:value-of select
="."/> gives me a newline character -->
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Any suggestions ??
Subbu
--------------------------------------------------------------
Sent with "Me-Mail", Boltblue's FREE mobile messaging service.
http://www.boltblue.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list