Link to home
Avatar of Tacobell777
Tacobell777

asked on

textarea XSL don't close node

I have the following in my xsl stylesheet

      <xsl:template
            match="OBJECT/PROPERTY[ @DISPLAYTYPE = 'textarea' ]">

            <label for="{@NAME}">
                  <xsl:value-of
                        select="@DISPLAYNAME" />
                  <!-- Check if a value is required -->
                  <xsl:if test="@REQUIRED = 'true'">
                        <span class="required">*</span>
                  </xsl:if>:
                  <textarea
                        name="{@NAME}"
                        cols="2"
                        rows="2">
                        
                  </textarea>
            </label>
            <br/>
      </xsl:template>

It produces <textarea name="test" cols="2" rows="2"/>
instead of
<textarea name="test" cols="2" rows="2"></textarea>
which is a problem...
I can't figure out how to get the result I am after without putting any text between the node..
Avatar of ChenChen
ChenChen
Flag of Afghanistan image


what about put a blank space like this: <textarea ...>&#160;</textarea>
Avatar of Tacobell777
Tacobell777

ASKER

yeah, I'm sure it would work, but I don't want to put anything in between.. it would mean there would be a space when someone starts typing, not that its a BIG BIG issue, but I just don't want and am hoping there is some other way, if not I will have to go with the blank space..

Im not sure it would work, might give a try:

<textarea><xsl:text></xsl:text></textarea>
nope did not work..
Avatar of ramazanyich
add
<xsl:output method="html"/>
before <xsl:template>
Try this:

 <xsl:template
          match="OBJECT/PROPERTY[ @DISPLAYTYPE = 'textarea' ]">

          <label for="{@NAME}">
               <xsl:value-of
                    select="@DISPLAYNAME" />
               <!-- Check if a value is required -->
               <xsl:if test="@REQUIRED = 'true'">
                    <span class="required">*</span>
               </xsl:if>:
               <![CDATA[
                    <textarea
                      name="{@NAME}"
                      cols="2"
                      rows="2">
                   
                    </textarea>
                ]]>
          </label>
          <br/>
     </xsl:template>

That's sort of hacky, but if it works, I suggest you just use it... still looking for an appropriate solution. But if you find that it works and it is good enuff, just let me know. Cheers.
Also try,

<xsl:value-of select="concat('&lt;textarea cols=&#34;2&#34; rows=&#34;2&#34; name=&#34;', @NAME, '&#34;&gt;&lt;/textarea&gt;')"/>
ASKER CERTIFIED SOLUTION
Avatar of dualsoul
dualsoul

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
"what about put a blank space like this: <textarea ...>&#160;</textarea> "

I think ChenChen had a good idea but, try using the HTML tag for a space

&nbsp


&nbsp = is the entity used to represent a non-breaking space in HTML
<textarea ...>&nbsp;</textarea>
I provided the same answer, why only one answer is accepted ?
sorry, I only see now that you did provide that answer.
I guess yours should have been accepted as the answer.
can it be fixed?
see https://www.experts-exchange.com/help.jsp#hi75
You should ask community support  to reopen question