[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
New line , white spaces and colors .
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 .
|
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|