GuardianOfTheFlame
Programmer
Hi all!
I have an XML file representing the definition of a page (a list of items such as radio, check, paragraph and textbox with their properties) and an XSL Tranformation used to visualize the page as HTML.
The problem is the formatting of the output (HTML), full of tabs, spaces and carriage returns that makes the output difficult to read and, more important, makes some problems with default values of textbox (tabs at the beginning hide the values that aren't displayed in the box if you don't move the cursor).
A simple example:
I create a form with a single textbox and this is the XML file in input:
This is the fragment of XSLT applied to textbox:
and this is the HTML in output:
I can't understand why the tabs are added in the value property of the textbox!
and how can I specify the indentation of the output?
Thanks,
Salo
P.S.: I hope that the question is clear... it's simple but difficult to explain :-/
I have an XML file representing the definition of a page (a list of items such as radio, check, paragraph and textbox with their properties) and an XSL Tranformation used to visualize the page as HTML.
The problem is the formatting of the output (HTML), full of tabs, spaces and carriage returns that makes the output difficult to read and, more important, makes some problems with default values of textbox (tabs at the beginning hide the values that aren't displayed in the box if you don't move the cursor).
A simple example:
I create a form with a single textbox and this is the XML file in input:
Code:
<xml>
<layout name="my_layout" pages="1" w="600" h="800" format="A4" style="nubistyle_1.css">
<page domid="container" name="container" orientation="portrait">
<items>
<item type="text" x="50" y="100" w="100" h="20" name="text_1" domid="text_1" tooltip="" group="" tabindex="" datatype="" minlen="" maxlen="" bordercolor="" bgcolor="" forecolor="" unique="0" required="0" disabled="0" multiline="0">
<content>
<![CDATA[Default value]]>
</content>
</item>
</items>
</page>
</layout>
</xml>
This is the fragment of XSLT applied to textbox:
Code:
...
<input type="text">
<xsl:call-template name="input_attributes">
<xsl:with-param name="type">text</xsl:with-param>
</xsl:call-template>
</input>
...
<!--Create the list of attributes for simple items-->
<xsl:template name="input_attributes">
<xsl:param name="type">text</xsl:param>
<xsl:if test="$type='text'">
<xsl:attribute name="value">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:if>
<xsl:attribute name="name">
<xsl:value-of select="@name" />
</xsl:attribute>
<xsl:attribute name="id">
<xsl:value-of select="@domid" />
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of select="@tooltip" />
</xsl:attribute>
<xsl:attribute name="maxlength">
<xsl:value-of select="@maxlen" />
</xsl:attribute>
<xsl:attribute name="tabindex">
<xsl:value-of select="@tabindex" />
</xsl:attribute>
<xsl:if test="@disabled='1'">
<xsl:attribute name="disabled"/>
</xsl:if>
<xsl:attribute name="style">
position: absolute;
top: <xsl:value-of select="@y" />px;
left: <xsl:value-of select="@x" />px;
width: <xsl:value-of select="@w" />px;
height: <xsl:value-of select="@h" />px;
<xsl:if test="@bgcolor!=''">background: <xsl:value-of select="@bgcolor" />;</xsl:if>
<xsl:choose>
<xsl:when test="@bordercolor=''">border: 1px solid black;</xsl:when>
<xsl:otherwise>border: 1px solid <xsl:value-of select="@bordercolor" />;</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="$type='text'">
<xsl:if test="@forecolor!=''">
color: <xsl:value-of select="@forecolor" />;
</xsl:if>
</xsl:when>
</xsl:choose>
</xsl:attribute>
</xsl:template>
and this is the HTML in output:
Code:
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Actide - my_layout</title><link rel="stylesheet" type="text/css" media="screen" href="css/nubistyle_1.css"></head><body><form><input type="text" value="
Default value
" name="text_1" id="text_1" title="" maxlength="" tabindex="" style="
position: absolute;
top: 100px;
left: 50px;
width: 100px;
height: 20px;
border: 1px solid black;"></form></body></html>
I can't understand why the tabs are added in the value property of the textbox!
and how can I specify the indentation of the output?
Thanks,
Salo
P.S.: I hope that the question is clear... it's simple but difficult to explain :-/