RE: How can I rotate text for a 90o sidebar?

2005-04-05 Thread Rymasz Jacky
This seems much cleaner than my solution indeed. ;)
Nice work!

Jack 

-Message d'origine-
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Envoyé : jeudi 31 mars 2005 17:52
À : fop-users@xmlgraphics.apache.org
Objet : RE: How can I rotate text for a 90o sidebar?

I hadn't really looked at this because the huge indentations put me off, but
now I've gotten around to it.

You can do this without disabling escape characters and by using literal
result elements. I'm inserting the whole stylesheet because the named
template needs to be called with certain parameters rather than just the
string you want rendered in stacked blocks (though you could write a
template that would take just the string). Here's the whole stylesheet
(tested on Saxon 8):

?xml version=1.0 encoding=UTF-8?
xsl:stylesheet
  version=2.0
  xmlns:xsl=http://www.w3.org/1999/XSL/Transform;
  xmlns:fo=http://www.w3.org/1999/XSL/Format;
  exclude-result-prefixes=fo

  xsl:template match=/
xsl:call-template name=scatter-string
  xsl:with-param name=text select=substring(.,2)/
  xsl:with-param name=rotatedselect=substring(.,1,1)/
/xsl:call-template
  /xsl:template
 
  xsl:template name=scatter-string
xsl:param name=text/
xsl:param name=rotated/
fo:blockxsl:value-of select=$rotated//fo:block
xsl:if test=string-length($text)  0
  xsl:call-template name=scatter-string
xsl:with-param name=text select=substring($text, 2)/
xsl:with-param name=rotated select=substring($text,1,1)/
  /xsl:call-template
/xsl:if
  /xsl:template

/xsl:stylesheet

The only change to the algorithm is to wrap the block around the result
rather than to insert it into a variable. Other than that, I removed all the
variables, as they were getting used only once. Instead, I put the values
that were going into the variables into the parameters. I also moved the
selects into the parameters and reduced the choose to an if, since the
otherwise was empty anyway.

FWIW

Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)




[EMAIL PROTECTED] 
03/30/2005 07:25 AM
Please respond to
fop-users@xmlgraphics.apache.org


To
fop-users@xmlgraphics.apache.org
cc

Subject
RE: How can I rotate text for a 90o sidebar?







Nice.  I'll check this out.
-Lou



  
  Rymasz Jacky   
  [EMAIL PROTECTED] To: 
fop-users@xmlgraphics.apache.org  
  decaux.fr   cc: 
   Subject: RE: How can I 
rotate text for a 90o sidebar?  
  03/29/2005 03:39
  Please respond   
  to fop-users   
  
  



Here a bit of code which scatter each letter of a string into a vertical
set
of blocks (ie: vertical string):

 xsl:template name=scatter-string
   xsl:paramname=text/
   xsl:paramname=rotated/
   xsl:variable name=lenxsl:value-of
select=string-length($text)//xsl:variable

   !-- Concat the blocks containing each letters --
   xsl:value-of disable-output-escaping=yes
select=$rotated/


   xsl:choose
   xsl:when test=$len  0
 xsl:variable
name=vrotated
 xsl:text
lt;fo:blockgt;/xsl:text
 xsl:value-of
select=substring($text,1,1)/
 xsl:text
lt;/fo:blockgt;/xsl:text
 /xsl:variable
 xsl:call-template
name=scatter-string

xsl:with-param name=text

xsl:value-of
select=substring($text, 2)/

/xsl:with-param

xsl:with-param name=rotated

xsl:value-of
select=$vrotated/

/xsl:with-param
 /xsl:call-template
   /xsl:when
   xsl:otherwise
   /xsl:otherwise
   /xsl:choose
 /xsl:template


I hope this could help ;)

Jack

-Message d'origine-
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Envoyé : lundi 28 mars 2005 15:57
À : fop-users@xmlgraphics.apache.org
Objet : RE: How can I rotate text for a 90o sidebar?


The following code prints top to bottom, but the letters are stacked. It's
a starting point.

svg:text x=1 y=1 writing-mode=tb glyph-orientation-vertical=0
YOUR
TEXT HERE /svg:text

-Lou




  Andreas L.

  DelmelleTo:
fop-users@xmlgraphics.apache.org

  [EMAIL PROTECTED] cc:

  ndora.beSubject: RE: How can I
rotate
text for a 90o sidebar?


  03/27/2005 06:30

  Please respond

RE: How can I rotate text for a 90o sidebar?

2005-04-04 Thread JBryant
I hadn't really looked at this because the huge indentations put me off, 
but now I've gotten around to it.

You can do this without disabling escape characters and by using literal 
result elements. I'm inserting the whole stylesheet because the named 
template needs to be called with certain parameters rather than just the 
string you want rendered in stacked blocks (though you could write a 
template that would take just the string). Here's the whole stylesheet 
(tested on Saxon 8):

?xml version=1.0 encoding=UTF-8?
xsl:stylesheet
  version=2.0
  xmlns:xsl=http://www.w3.org/1999/XSL/Transform;
  xmlns:fo=http://www.w3.org/1999/XSL/Format;
  exclude-result-prefixes=fo

  xsl:template match=/
xsl:call-template name=scatter-string
  xsl:with-param name=text select=substring(.,2)/
  xsl:with-param name=rotatedselect=substring(.,1,1)/
/xsl:call-template
  /xsl:template
 
  xsl:template name=scatter-string
xsl:param name=text/
xsl:param name=rotated/
fo:blockxsl:value-of select=$rotated//fo:block
xsl:if test=string-length($text)  0
  xsl:call-template name=scatter-string
xsl:with-param name=text select=substring($text, 2)/
xsl:with-param name=rotated select=substring($text,1,1)/
  /xsl:call-template
/xsl:if
  /xsl:template

/xsl:stylesheet

The only change to the algorithm is to wrap the block around the result 
rather than to insert it into a variable. Other than that, I removed all 
the variables, as they were getting used only once. Instead, I put the 
values that were going into the variables into the parameters. I also 
moved the selects into the parameters and reduced the choose to an if, 
since the otherwise was empty anyway.

FWIW

Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)




[EMAIL PROTECTED] 
03/30/2005 07:25 AM
Please respond to
fop-users@xmlgraphics.apache.org


To
fop-users@xmlgraphics.apache.org
cc

Subject
RE: How can I rotate text for a 90o sidebar?







Nice.  I'll check this out.
-Lou



  
  Rymasz Jacky   
  [EMAIL PROTECTED] To: 
fop-users@xmlgraphics.apache.org  
  decaux.fr   cc: 
   Subject: RE: How can I 
rotate text for a 90o sidebar?  
  03/29/2005 03:39
  Please respond   
  to fop-users   
  
  



Here a bit of code which scatter each letter of a string into a vertical
set
of blocks (ie: vertical string):

 xsl:template name=scatter-string
   xsl:paramname=text/
   xsl:paramname=rotated/
   xsl:variable name=lenxsl:value-of
select=string-length($text)//xsl:variable

   !-- Concat the blocks containing each letters --
   xsl:value-of disable-output-escaping=yes
select=$rotated/


   xsl:choose
   xsl:when test=$len  0
 xsl:variable
name=vrotated
 xsl:text
lt;fo:blockgt;/xsl:text
 xsl:value-of
select=substring($text,1,1)/
 xsl:text
lt;/fo:blockgt;/xsl:text
 /xsl:variable
 xsl:call-template
name=scatter-string

xsl:with-param name=text

xsl:value-of
select=substring($text, 2)/

/xsl:with-param

xsl:with-param name=rotated

xsl:value-of
select=$vrotated/

/xsl:with-param
 /xsl:call-template
   /xsl:when
   xsl:otherwise
   /xsl:otherwise
   /xsl:choose
 /xsl:template


I hope this could help ;)

Jack

-Message d'origine-
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Envoyé : lundi 28 mars 2005 15:57
À : fop-users@xmlgraphics.apache.org
Objet : RE: How can I rotate text for a 90o sidebar?


The following code prints top to bottom, but the letters are stacked. It's
a starting point.

svg:text x=1 y=1 writing-mode=tb glyph-orientation-vertical=0
YOUR
TEXT HERE /svg:text

-Lou




  Andreas L.

  DelmelleTo:
fop-users@xmlgraphics.apache.org

  [EMAIL PROTECTED] cc:

  ndora.beSubject: RE: How can I
rotate
text for a 90o sidebar?


  03/27/2005 06:30

  Please respond

  to fop-users








 -Original Message-
 From: Tommy Reynolds [mailto:[EMAIL PROTECTED]


Hi,

 I'm trying to insert some text into xsl-region-start and I'd like it
 rotated 90-degrees to you'd have to tilt your head sideways to read
 it.  I