XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Shannon MSubject: Undesired space+newline inserted in XSLT by WYSIWYG view
Author: Shannon M
Date: 09 May 2006 02:16 PM
This seems like FAQ material, however my forum searches haven't found related information.

Suppose I have the following XSLT instruction. Note leading carets ('^') represent tabs, trailing ones represent spaces.

^^^^^^^^^^<xsl:value-of select="@progress"/>% (<xsl:value-of select="@minutes"/>)

When switching from 'XSLT Source' to 'WYSIWYG' view tabs, Stylus Studio inserts a newline, and sufficient tabs to indent the new line to match the previous line. It does this regardless of whether I make any changes via WYSIWYG:

^^^^^^^^^^<xsl:value-of select="@progress"/>% (
^^^^^^^^^^<xsl:value-of select="@minutes"/>)

Ok, so that's bad, because it nearly doubles my bandwidth consumption. As troublesome (or moreso, depending on your application) is that if I switch to WYSIWYG a second time, it inserts a visible space in my text content:

^^^^^^^^^^<xsl:value-of select="@progress"/>% (^
^^^^^^^^^^<xsl:value-of select="@minutes"/>)

How can I:
1. Turn off indenting altogether.
2. Prevent Stylus Studio from breaking lines I've typed.
3. Prevent Stylus Studio from adding visible whitespace.

Postnext
Ivan PedruzziSubject: Undesired space+newline inserted in XSLT by WYSIWYG view
Author: Ivan Pedruzzi
Date: 09 May 2006 02:36 PM
Hi Shannon

Switching from a very verbose form to a much more compact one will solve most of you problems and will make your style-sheet more readable

from
<xsl:value-of select="@progress"/>% (<xsl:value-of select="@minutes"/>)

to
<xsl:value-of select="concat(@progress, '%(', @minutes, ')')"/>

If you need to create a large chunk of literal text you can use
<xsl:text> </xsl:text>


Hope this helps
Ivan Pedruzzi
Stylus Studio Team

Postnext
Shannon MSubject: Undesired space+newline inserted in XSLT by WYSIWYG view
Author: Shannon M
Date: 09 May 2006 02:47 PM
ya know, I knew you were gonna say that :).
I can't wrap my whole XSLT in a concat, though.
Don't you think Stylus Studio should be nicer to my code?

At any rate, it definitely has no right to add a space on the end of that line, especially when it creates visual results that vary depending on how many times I've clicked the WYSIWYG tab. That one at a minimum is bug material.

Postnext
Shannon MSubject: Undesired space+newline inserted in XSLT by WYSIWYG view
Author: Shannon M
Date: 09 May 2006 03:02 PM
p.s. My post was intended to be a compact representation of the problem, to save you time. I created the sample entirely in the WYSIWYG designer, because I was especially surprised by the secondary modification it made. Thus, no concat function.

p.p.s. Give me a moment and I'll give you an example that is not optimally correctable by modifying the function.

Postnext
Shannon MSubject: Undesired space+newline inserted in XSLT by WYSIWYG view
Author: Shannon M
Date: 09 May 2006 03:28 PM
<xsl:value-of select="concat(@itemcount,' item')"/><xsl:if test="@itemcount != 1">s</xsl:if>

there ya go.

Postnext
Ivan PedruzziSubject: Undesired space+newline inserted in XSLT by WYSIWYG view
Author: Ivan Pedruzzi
Date: 09 May 2006 03:56 PM

I understand sometime is difficult for beginner to became productive with XSLT.

That's very easy

<xsl:variable name="s">
<xsl:if test="@bookid != 1">s</xsl:if>
</xsl:variable>
<xsl:value-of select="concat(@bookid,' item', $s)"/>

Also would be much safer if you wrap your literal text using xsl:text;
back to your original example

<xsl:value-of select="@progress"/>% (<xsl:value-of select="@minutes"/>)

If you feel the need to explode each single value-of then do the following

<xsl:value-of select="@progress"/>
<xsl:text>% (</xsl:text>
<xsl:value-of select="@minutes"/>
<xsl:text>)</xsl:text>

I hope you are here to get your the job done, then we are glad to have you and help you if we can.

Hope this helps
Ivan Pedruzzi
Stylus Studio Team

Postnext
Shannon MSubject: Undesired space+newline inserted in XSLT by WYSIWYG view
Author: Shannon M
Date: 09 May 2006 04:09 PM
LOL, your assumption that I am new to XSL is witty, if not serious.

If I wanted to be hand-coding stylesheets, I would have continued using Visual Studio, rather than purchasing Stylus Studio.

Yes, I suspected you would recommend either using a variable or replicating the entire output inside an xsl:if block.

Firstly, that certainly didn't make it clearer.
Secondly, depending on the preceding tags, Stylus Studio may still break the line and insert a space prior to the 's' representing the plural items, creating a variable with an inherent space.

Thus, not only is it not more elegant, it does not solve the problem I mentioned.

If your point, ultimately, is that it is suboptimal to put whitespace formatting in text blocks, I agree. However, the XML whitespace handling rules exist for a reason, and they should be observed by the editor as well as the processor. Sometimes code similar to the examples I've given is necessary.

I take the end result to be there is not a way to prevent Stylus Studio from exhibiting any of the three behaviours I asked after?

Would you please submit a bug request for me?

Postnext
Shannon MSubject: Undesired space+newline inserted in XSLT by WYSIWYG view
Author: Shannon M
Date: 09 May 2006 04:11 PM
p.s. If I wasn't here to be productive, I wouldn't have shelled out for a productivity tool.

Postnext
Shannon MSubject: Undesired space+newline inserted in XSLT by WYSIWYG view
Author: Shannon M
Date: 09 May 2006 04:16 PM
Further, I note that I took a break from my productive day specifically to help DataDirect improve their product, by crafting an example for the sole purpose of demonstrating the side-effects of the issue. Now I'm somewhat peeved that you'd question my motives.

I was quite pleasant about it when we began, not complaining that the issue caused me to lose productivity, rather taking my time to help improve your product.

Now, I'm somewhat sorry I did.

Postnext
Ivan PedruzziSubject: Undesired space+newline inserted in XSLT by WYSIWYG view
Author: Ivan Pedruzzi
Date: 09 May 2006 04:49 PM

Could you please tell us which Stylus Studio edition/build are you running so we can track your comments?

Thank You
Ivan Pedruzzi
Stylus Studio Team

Postnext
Shannon MSubject: Undesired space+newline inserted in XSLT by WYSIWYG view
Author: Shannon M
Date: 09 May 2006 04:55 PM
sure,
2006 XML Enterprise Edition

As a consultant, I bill hourly. Unless you are paying me to help improve the product, I don't bill for the time spent doing so.

Obviously, I wouldn't fabricate issues just for the fun of it.

Postnext
Shannon MSubject: Undesired space+newline inserted in XSLT by WYSIWYG view
Author: Shannon M
Date: 09 May 2006 04:56 PM
update tells me I'm running the latest version

Postnext
Shannon MSubject: Undesired space+newline inserted in XSLT by WYSIWYG view
Author: Shannon M
Date: 09 May 2006 05:20 PM
Originally Posted: 09 May 2006 05:21 PM
which is of course 501i

Postnext
Ivan PedruzziSubject: Undesired space+newline inserted in XSLT by WYSIWYG view
Author: Ivan Pedruzzi
Date: 09 May 2006 05:53 PM
The latest Stylus Studio version is 2006 release 2 (build 591c)

The white-space behavior is a side effect of passing through the IE HTML renderer. When the HTML DOM comes back to Stylus sometime gets elements re-arranged or completely stripped out. There is very little we can do to fix it but so far changing the code style has solved most of our customer problems.

In the meanwhile our team is working a new module that will take a different approach. We hope to have a public beta for the Summer.

Ivan Pedruzzi
Stylus Studio Team

Posttop
Shannon MSubject: Undesired space+newline inserted in XSLT by WYSIWYG view
Author: Shannon M
Date: 09 May 2006 06:17 PM
Ok, makes sense. Thank you for providing further information.

I'm not sure why I have an old version, I just downloaded it from a link provided during purchase one week ago, and update doesn't offer me any updates. I did something dumb, undoubtedly.

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.