Subject: New line , white spaces and colors . From: "Chanukov Orit" <orit@xxxxxxxxxxxxxxx> Date: Tue, 29 Jun 1999 18:25:32 +0200 |
Hello .
I work with IE5 .I have a little (hopefully) problem
.
Here is my XML file :
<?xml version='1.0'?>
<?xml:stylesheet type="text/xsl" href="" ?> <Screen > <Field colr="0"> First Field should be displayed with offset 20 .</Field> <Field colr="1"> Second field should be shown on the same line </Field> </Screen> I need :
1.To
display all Fields on the same line .
2. To preserve white spaces ( I use <PRE> element
for this purpose ) .
3.To get the value of the Field's "colr" attribute and
according to this attribute to set the color of the displayed text
. My XSL does 2 and 3 successfully , but failed
with 1- it starts the second Field from the new line .Why ?
If I delete the <font> section from the
Field template , it works correctly ,but without color processing .
If I don't use <PRE> element , it displays the two
fields on the same line and with correct color , but strips the white
spaces .(I tried a lot of another variants for preserving white spaces , but it
was solved only by using <PRE> element ) .
Below you can see my XSL file :
Fields.xsl :
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <HTML xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <BODY STYLE="background-color:silver" > <xsl:apply-templates /> </BODY> </HTML> </xsl:template> <xsl:template
match="Screen">
<PRE><xsl:apply-templates /></PRE> </xsl:template>
<xsl:template
match="Field">
<font> <xsl:apply-templates select="@colr"/> </font> <xsl:apply-templates /> </xsl:template> <xsl:template match="text()"><xsl:value-of
/></xsl:template>
<xsl:template match="@colr">
<xsl:attribute name="STYLE">color: <xsl:choose> <xsl:when test=".[.='J']">blue</xsl:when > <xsl:otherwise >black</xsl:otherwise > </xsl:choose> </xsl:attribute> </xsl:template> </xsl:stylesheet> Thanks in advance for any ideas , examples and comments
.
Orit .
|
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Dynamic XSL, Amit Khemka | Thread | escape character for carriage-retur, Aaron Fischer |
Re:RE: XSLT vs JSP, KAREN_LEICHEL | Date | Re: XSLT vs JSP, Paul Prescod |
Month |