You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by xa...@xml.apache.org on 2004/10/01 06:57:34 UTC

[jira] Commented: (XALANJ-1974) Doubles newline character

The following comment has been added to this issue:

     Author: vaibhav kakadia
    Created: Thu, 30 Sep 2004 9:56 PM
       Body:
MY XML is given below in which you can see 
.

<msg-text-presentation_-tO><current-date>01-10-2004</current-date><form-action>edit</form-action><form-name>Bobby-1</form-name><form-code>BB1</form-code><msg-title>abc</msg-title><selected-controller-user-iD xsi:type="java:com.asite.collab.forms.create.bizlogic.helper.DisplayPrevented" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/><respond-by-date xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">01-10-2004</respond-by-date><msg-content>abc&#xd;
&#xd;
abc</msg-content><hyperlink xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">abc</hyperlink><user-ref xsi:type="java:java.lang.String" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">abc</user-ref></msg-text-presentation_-tO>


and my jsp file in which I have used Xsl is given below.


<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<%@page import="com.asite.collab.common.presentation.constants.IPresentationConstants,
                com.asite.collab.forms.create.shared.constants.IFormsCreateConstants,
                com.asite.collab.dms.common.constants.ISystemPagesDM"%>
<%@page import="com.asite.collab.common.shared.constants.ISystemConstants"%>
<%@page import="com.asite.collab.common.shared.constants.ISystemPages"%>
<%@page import="com.asite.collab.forms.create.shared.constants.IFormsCreatePages"%>
<%@page import="com.asite.collab.forms.create.shared.constants.IFormsCreateActions"%>
<%@page import="com.asite.collab.forms.common.shared.constants.IFormsCommonConstants"%>
<%@page import="com.asite.collab.forms.common.persistence.transfer.FormMsgTypeVO"%>
<%@ page buffer="16kb" %>
<%
    //Get message type from session
    FormMsgTypeVO msgTypeVo = (FormMsgTypeVO) session.getAttribute(IFormsCreateConstants.MSG_TYPE_VO_KEY);
    String msgType = "ERROR";
    int msgTypeId = -1;
    if (msgTypeVo != null) {
        msgType = msgTypeVo.msgTypeCode;
        msgTypeId = msgTypeVo.msgTypeId.intValue();
    }
%>
<xsl:output method="html"/>
<%String controllerPath = getServletConfig().getServletContext().getInitParameter("pathdmsa");%>
<xsl:include href="<%=controllerPath%><%=ISystemPagesDM.IIS_PATH_XSL%>"/>
<xsl:template match="/msg-text-presentation_-tO">
<html>
<head>
    <title>Form details</title>
    <script language="JavaScript" type="text/javascript">
        todaysDate = '<xsl:value-of select="current-date"/>';
    // <![CDATA[

        function validateMyForm() {
            allOk = true;

            if (document.thisForm.<%=IFormsCommonConstants.FORM_MESSAGE_TEXT%>) {
                if (document.thisForm.<%=IFormsCommonConstants.FORM_MESSAGE_TEXT%>.value.length > 3999) {
                    window.alert("The message content cannot be longer than 4000 characters!");
                    allOk=false;
                }

                if ((allOk) && (document.thisForm.<%=IFormsCommonConstants.FORM_MESSAGE_TEXT%>.value=="Enter content here...")) {
                    document.thisForm.<%=IFormsCommonConstants.FORM_MESSAGE_TEXT%>.value="";
                }
            }

            if (document.thisForm.<%=IFormsCommonConstants.FORM_RESPOND_BY%>) {
                if ((allOk) && (document.thisForm.<%=IFormsCommonConstants.FORM_RESPOND_BY%>) && (document.thisForm.<%=IFormsCommonConstants.FORM_RESPOND_BY%>.value.length>0)) {
                    if (isDate(document.thisForm.<%=IFormsCommonConstants.FORM_RESPOND_BY%>.value, "dd-MM-yyyy")) {
                        d1 = getDateFromFormat(todaysDate,"dd-MM-yyyy");
                        d2 = getDateFromFormat(document.thisForm.<%=IFormsCommonConstants.FORM_RESPOND_BY%>.value,"dd-MM-yyyy");
                        if (d2<d1) {
                            window.alert("The selected date must be today or later.");
                            allOk=false;
                        }
                    } else {
                        window.alert("The date is not valid. It must be empty or in the format dd-mm-yyyy");
                        allOk=false;
                    }
                }
            }

            return allOk;
        }

        function clearForm() {
            document.thisForm.reset();
            // 4478.dramani.20-july.Add start
            try {
                document.thisForm.<%=IFormsCommonConstants.FORM_MESSAGE_TEXT%>.innerHTML = "";
                for (var i=0;i < document.thisForm.elements.length;i++)
                {
                    var e = document.thisForm.elements[i];
                    if(e.type == "text" || e.type == "TEXT")
                    {
						//vkakadia.02-Sep-04.4651.add start
						if(e.disabled==false)
						{
	                        e.value = "";
						}
						//vkakadia.02-Sep-04.4651.add end
                    }

                }
            }catch(e) {
                // Do nothing in javascript exception.
            }
            // 4478.dramani.20-july.Add end
        }

        function submitForm() {
            if (validateMyForm()) {
                document.thisForm.<%=ISystemConstants.ACTION_ID%>.value='<%=IFormsCreateActions.SUBMIT_MESSAGE_TEXT_DETAILS%>';
                document.thisForm.<%=IFormsCreateConstants.SAVE_DRAFT%>.value = <%= IFormsCreateConstants.SAVE_DRAFT_FALSE %>;
                document.thisForm.submit();
            } else {
                return false;
            }
        }

        function saveDraft() {
            if (validateMyForm()) {
                document.thisForm.<%=ISystemConstants.ACTION_ID%>.value='<%=IFormsCreateActions.SUBMIT_MESSAGE_TEXT_DETAILS%>';
                document.thisForm.<%=IFormsCreateConstants.SAVE_DRAFT%>.value = <%= IFormsCreateConstants.SAVE_DRAFT_TRUE %>;
                document.thisForm.submit();

            } else {
                return false;
            }
        }

		function validateExAttribute(obj,len)
		{
			if(obj.value.length > len)
			{
				alert('Value cannot be more than ' + len + ' characters.');
				obj.focus();
			}
		}
        // ]]>
    </script>
    <script type="text/javascript" language="javascript" src="<%= ISystemPages.server_base%>/scripts/CalendarPopup.js">
        function this() {
        }
    </script>
    <script type="text/javascript" language="javascript" src="<%= ISystemPages.server_base%>/scripts/AnchorPosition.js">
        function this() {
        }
    </script>
    <script type="text/javascript" language="javascript" src="<%= ISystemPages.server_base%>/scripts/PopupWindow.js">
        function this() {
        }
    </script>
    <script type="text/javascript" language="javascript" src="<%= ISystemPages.server_base%>/scripts/date.js">
        function this() {
        }
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
    <link rel="stylesheet" href="{$css-dir}<%= ISystemPages.CSS_MAIN_3%>" type="text/css"/>
    <script LANGUAGE="JavaScript">document.write(CalendarPopup_getStyles());</script>
</head>

<body>
<form name="thisForm" action="<%=ISystemPages.server_base%><%=IFormsCreatePages.CREATE_MSG_CONTROLLER%>" target="_top" method="post">
    <input type="hidden" name="<%=ISystemConstants.ACTION_ID%>" value="<%=IFormsCreateActions.SUBMIT_MESSAGE_TEXT_DETAILS%>"/>
    <input type="hidden" name="<%=IFormsCreateConstants.SAVE_DRAFT%>"></input>
<TABLE align="center" cellspacing="0" cellpadding="5">
        <TR>
          <TD VALIGN="middle" align="left" class="body1red"> <b><xsl:value-of select="form-code"/> Title:</b><font color="red">*</font><br />
            <%
                String disabled = "";
                if (!(msgTypeId == ISystemConstants.MSG_TYPE_ORI)) {
                //grey out form title if not ORI
                disabled = " disabled=\"disabled\"";
            %>
                <input type="hidden" name="<%=IFormsCommonConstants.FORM_MESSAGE_NAME%>" size="60" value="{msg-title}" />
            <%
                }
            %>
            <input type="text" name="<%=IFormsCommonConstants.FORM_MESSAGE_NAME%>" size="60" maxlength="100" class="body1red"<%=disabled%>>
	            <xsl:attribute name="value"><xsl:value-of select="msg-title"/></xsl:attribute>
            </input>
          </TD>
        </TR>
        <xsl:if test="not(selected-controller-user-iD/@xsi:type= 'java:com.asite.collab.forms.create.bizlogic.helper.DisplayPrevented')">
        <% if (msgTypeId == ISystemConstants.MSG_TYPE_ORI) {
            //show to user only if message type is ORI
        %>
        <tr>
          <td VALIGN="middle" align="left" class="body1red"><b><xsl:value-of select="form-code"/> Controller:</b><font color="red">*</font><br />
            <select name="<%=IFormsCreateConstants.FORM_SELECTED_CONTROLLER_USER_ID%>" class="body1red">
              <option value="" selected="selected">Please Select</option>
              <xsl:apply-templates select="controller-user-list">
              	<xsl:with-param name="selectedUserId" select="selected-controller-user-iD"/>
              </xsl:apply-templates>
            </select>
          </td>
        </tr>
        <% } else { %>
            <input type="hidden" name="<%=IFormsCreateConstants.FORM_SELECTED_CONTROLLER_USER_ID%>">
                <xsl:attribute name="value"><xsl:value-of select="selected-controller-user-iD"/></xsl:attribute>
            </input>
        <% } //if msgTypeId %>
        </xsl:if>
        <xsl:if test="not(user-ref/@xsi:type= 'java:com.asite.collab.forms.create.bizlogic.helper.DisplayPrevented')">
        <% if (msgTypeId == ISystemConstants.MSG_TYPE_ORI) {
                //show to user only if message type is ORI
        %>
        <tr>
          <td VALIGN="TOP" class="body1red"><b>User Ref. Code:</b><br />

            <input type="text" name="<%=IFormsCommonConstants.FORM_USER_REF%>" size="50" maxlength="50" class="body1red">
                <xsl:attribute name="value"><xsl:value-of select="user-ref"/></xsl:attribute>
            </input>
          </td>
        </tr>
        <% } else { %>
            <input type="hidden" name="<%=IFormsCommonConstants.FORM_USER_REF%>">
                <xsl:attribute name="value"><xsl:value-of select="user-ref"/></xsl:attribute>
            </input>
        <% } //if msgTypeId %>
        </xsl:if>
        <xsl:if test="not(hyperlink/@xsi:type= 'java:com.asite.collab.forms.create.bizlogic.helper.DisplayPrevented')">
        <tr>
          <td VALIGN="TOP" class="body1red"><b>Hyperlink:</b><br />

            <input type="text" name="<%=IFormsCommonConstants.FORM_HYPERLINK%>" size="60" maxlength="254" class="body1red">
                <xsl:attribute name="value"><xsl:value-of select="hyperlink"/></xsl:attribute>
            </input>
          </td>
        </tr>
        </xsl:if>
        <TR>
          <TD VALIGN="TOP" class="body1red"> <b><xsl:value-of select="form-code"/> 
				<xsl:choose>
					<xsl:when test="contentlabel" >&#160;<xsl:value-of select="contentlabel"/></xsl:when>
					<xsl:otherwise>&#160;Content</xsl:otherwise>
				</xsl:choose>:
				</b>&#160;(maximum 4000 characters)<br />
            <textarea name="<%=IFormsCommonConstants.FORM_MESSAGE_TEXT%>" rows="6"  class="body1red" cols="60">
                <xsl:if test="msg-content/text()"><xsl:value-of select="msg-content"/></xsl:if>
            </textarea>
          </TD>
        </TR>
		<xsl:apply-templates select="enhanced-form-vOList" />

		<xsl:if test="not(respond-by-date/@xsi:type= 'java:com.asite.collab.forms.create.bizlogic.helper.DisplayPrevented')">
        <TR>
          <TD class="body1red"> <b>Respond by:</b><font color="red">*</font><br />
            <input TYPE="text" NAME="<%=IFormsCommonConstants.FORM_RESPOND_BY%>" size="10" maxlength="10" class="body1red">
            	<xsl:attribute name="value"><xsl:value-of select="respond-by-date"/></xsl:attribute>
            </input>
            <script language="javascript">

                var cal1 = new CalendarPopup("testdiv1");
                    cal1.offsetY = -120;

            </script>
            <A HREF="#" onClick="cal1.select(document.forms[0].<%=IFormsCommonConstants.FORM_RESPOND_BY%>,'anchor1','dd-MM-yyyy'); return false;" NAME="anchor1" ID="anchor1"><img border="0" src="{$image-dir}/calendar.gif" width="34" height="21" align="center"/></A><xsl:text> </xsl:text>(dd-mm-yyyy)
          </TD>
        </TR>
        </xsl:if>
        <tr><td class="body1red">(Fields marked with <font color="red">*</font> are mandatory)</td></tr>
  </TABLE>
  <DIV ID="testdiv1" STYLE="position:absolute;visibility:hidden;background-color:white;layer-background-color:white;width:1.5in;height:1.5in"></DIV>
  </form>
</body>
</html>
</xsl:template>

<xsl:template match="controller-user-list">
<xsl:param name="selectedUserId"/>
<option>
	<xsl:attribute name="value"><xsl:value-of select="user-iD"/></xsl:attribute>
        <xsl:if test="user-iD = $selectedUserId">
		<xsl:attribute name="selected">selected</xsl:attribute>
	</xsl:if>
        <xsl:value-of select="fname"/><xsl:text> </xsl:text><xsl:value-of select="lname"/>
        <xsl:text>, </xsl:text><xsl:value-of select="org-name"/><xsl:text> - </xsl:text><xsl:value-of select="project-role"/>
</option>
</xsl:template>

<xsl:template match="enhanced-form-vOList">
<tr>
			<td valign="top" class="body1red"> 
				<xsl:choose>
					<xsl:when test="control_type_id = '<%=ISystemConstants.UI_CONTROL_TEXTAREA%>'">
						<b><xsl:value-of select="label" />:</b> (maximum 4000 characters) <br/>
						<textarea name="attribute_{attribute_id}" rows="6" cols="60" class="body1red" >
							<xsl:value-of select="value"/>
						</textarea>
					</xsl:when>
					<xsl:when test="control_type_id = '<%=ISystemConstants.UI_CONTROL_TEXTBOX%>'">
						<b><xsl:value-of select="label" />:</b> <br/>
						<input type="text" name="attribute_{attribute_id}" size="60" class="body1red" onblur="validateExAttribute(this,250);">
			                <xsl:attribute name="value"><xsl:value-of select="value"/></xsl:attribute>
			            </input>	
					</xsl:when>
					<xsl:otherwise> </xsl:otherwise>
				</xsl:choose>					
			</td>
		</tr>

</xsl:template>

</xsl:stylesheet>


---------------------------------------------------------------------
View this comment:
  http://issues.apache.org/jira/browse/XALANJ-1974?page=comments#action_53571

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/XALANJ-1974

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: XALANJ-1974
    Summary: Doubles newline character
       Type: Bug

     Status: Unassigned
   Priority: Critical

    Project: XalanJ2
 Components: 
             Serialization
   Versions:
             2.6

   Assignee: 
   Reporter: vaibhav kakadia

    Created: Wed, 29 Sep 2004 2:50 AM
    Updated: Thu, 30 Sep 2004 9:56 PM
Environment: Windows Xp Professional O.S., Jrun 4, netBeans 3.6, sql server, jdk 1.4.2_03

Description:
Hi,

   It seems to be a strage problem. I put a text like 
1
2
and saves data. When I come back it is 
1

2
I again saved data and came back it is
1



2
It seems that it is unable to parse #xd;#xa; (CR-LF) into #xa; (LF). So it increases newline character everytime. I don't know why this problem arises but when I was using older version of Xalan set it was 2.2.0 this was not taking place.

Please do the needful.

Vaibhav


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org