Loading ...
Sorry, an error occurred while loading the content.

Re: [XSL-FO] url wrapping

Expand Messages
  • G. Ken Holman
    ... I m assuming you are doing this with a recursive call? ... I just use a recursive call and inject a zero-width space ​ after the path separating /
    Message 1 of 5 , May 18, 2004
    • 0 Attachment
      At 2004-05-19 02:46 +0000, gjlloyd wrote:
      >i have somewhat solved the problem of wrapping by inserting a
      >non-space character between every character in the url.. this allows
      >the flow to push whatever part of the url that doesn't fit on one line
      >to the next line.

      I'm assuming you are doing this with a recursive call?

      >but this sometimes results in only the last character ('m' or 'l' or
      >whatever) to be pushed to the next line, which is not very readble.
      >
      >what i'd really like to do is only insert the non-space character at
      >certain spots throughout the hyperlink.. like at the dots or //'s..
      >this would break the url at more logical places.
      >
      >its VERY diffucult to do such text processing in XSL

      I just use a recursive call and inject a zero-width space ​ after
      the path separating "/" characters. Use substring-before and
      substring-after to chop up the URL while doing the recursive processing.

      I hope this helps.

      ...................... Ken

      --
      Public courses: Spring 2004 world tour of hands-on XSL instruction
      Next: 3-day XSLT/XPath; 2-day XSL-FO - Birmingham, UK June 14,2004

      World-wide on-site corporate, govt. & user group XML/XSL training.
      G. Ken Holman mailto:gkholman@...
      Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
      Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
      Male Breast Cancer Awareness http://www.CraneSoftwrights.com/f/bc
      Legal business disclaimers: http://www.CraneSoftwrights.com/legal
    • gjlloyd
      yes, this does help, and yes i m using a recursive template, but have been unable to get it to behave as desired. do you have a code snippet handy for this
      Message 2 of 5 , May 18, 2004
      • 0 Attachment
        yes, this does help, and yes i'm using a recursive template, but have
        been unable to get it to behave as desired. do you have a code snippet
        handy for this task?

        thanks much

        G

        --- In XSL-FO@yahoogroups.com, "G. Ken Holman" <gkholman@c...> wrote:
        > At 2004-05-19 02:46 +0000, gjlloyd wrote:
        > >i have somewhat solved the problem of wrapping by inserting a
        > >non-space character between every character in the url.. this allows
        > >the flow to push whatever part of the url that doesn't fit on one line
        > >to the next line.
        >
        > I'm assuming you are doing this with a recursive call?
        >
        > >but this sometimes results in only the last character ('m' or 'l' or
        > >whatever) to be pushed to the next line, which is not very readble.
        > >
        > >what i'd really like to do is only insert the non-space character at
        > >certain spots throughout the hyperlink.. like at the dots or //'s..
        > >this would break the url at more logical places.
        > >
        > >its VERY diffucult to do such text processing in XSL
        >
        > I just use a recursive call and inject a zero-width space ​
        after
        > the path separating "/" characters. Use substring-before and
        > substring-after to chop up the URL while doing the recursive processing.
        >
        > I hope this helps.
        >
        > ...................... Ken
        >
        > --
        > Public courses: Spring 2004 world tour of hands-on XSL instruction
        > Next: 3-day XSLT/XPath; 2-day XSL-FO - Birmingham, UK June 14,2004
        >
        > World-wide on-site corporate, govt. & user group XML/XSL training.
        > G. Ken Holman mailto:gkholman@C...
        > Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
        > Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
        > Male Breast Cancer Awareness http://www.CraneSoftwrights.com/f/bc
        > Legal business disclaimers: http://www.CraneSoftwrights.com/legal
      • G. Ken Holman
        ... Below is a snippet from my work on the Universal Business Language (UBL) project. I hope you can use it to suit you. ............................... Ken
        Message 3 of 5 , May 19, 2004
        • 0 Attachment
          At 2004-05-19 03:04 +0000, gjlloyd wrote:
          >yes, this does help, and yes i'm using a recursive template, but have
          >been unable to get it to behave as desired. do you have a code snippet
          >handy for this task?

          Below is a snippet from my work on the Universal Business Language (UBL)
          project.

          I hope you can use it to suit you.

          ............................... Ken

          p.s. I'm just going off-line for 72 hours while traveling from Hong Kong
          back to Canada so I won't be able to respond to any posts for a while ...
          if you continue to have problems perhaps someone else can pick up this thread.

          ...
          <xsl:call-template name="replace">
          <xsl:with-param name="string" select="."/>
          <xsl:with-param name="old" select="'/'"/>
          <xsl:with-param name="new" select="'/​'"/><!--zero-width space-->
          </xsl:call-template>
          ...

          <!--========================================================================-->

          <!--replace all occurrences of $old by $new in $string-->
          <xsl:template name="replace">
          <xsl:param name="string"/>
          <xsl:param name="old" select="'????????'"/>
          <xsl:param name="new"/>
          <xsl:choose>
          <xsl:when test="contains( $string, $old )">
          <xsl:value-of select="substring-before( $string, $old )"/>
          <xsl:value-of select="$new"/>
          <xsl:call-template name="replace">
          <xsl:with-param name="string"
          select="substring-after( $string, $old )"/>
          <xsl:with-param name="old" select="$old"/>
          <xsl:with-param name="new" select="$new"/>
          </xsl:call-template>
          </xsl:when>
          <xsl:otherwise>
          <xsl:value-of select="$string"/>
          </xsl:otherwise>
          </xsl:choose>
          </xsl:template>


          --
          Public courses: Spring 2004 world tour of hands-on XSL instruction
          Next: 3-day XSLT/XPath; 2-day XSL-FO - Birmingham, UK June 14,2004

          World-wide on-site corporate, govt. & user group XML/XSL training.
          G. Ken Holman mailto:gkholman@...
          Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
          Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
          Male Breast Cancer Awareness http://www.CraneSoftwrights.com/f/bc
          Legal business disclaimers: http://www.CraneSoftwrights.com/legal
        • gjlloyd
          THANKS! thats EXACTLY what i needed. you have ended many hours of misery. G ... (UBL) ... Kong ... while ... ... this thread. ...
          Message 4 of 5 , May 19, 2004
          • 0 Attachment
            THANKS!

            thats EXACTLY what i needed. you have ended many hours of misery.

            G

            --- In XSL-FO@yahoogroups.com, "G. Ken Holman" <gkholman@c...> wrote:
            > At 2004-05-19 03:04 +0000, gjlloyd wrote:
            > >yes, this does help, and yes i'm using a recursive template, but have
            > >been unable to get it to behave as desired. do you have a code snippet
            > >handy for this task?
            >
            > Below is a snippet from my work on the Universal Business Language
            (UBL)
            > project.
            >
            > I hope you can use it to suit you.
            >
            > ............................... Ken
            >
            > p.s. I'm just going off-line for 72 hours while traveling from Hong
            Kong
            > back to Canada so I won't be able to respond to any posts for a
            while ...
            > if you continue to have problems perhaps someone else can pick up
            this thread.
            >
            > ...
            > <xsl:call-template name="replace">
            > <xsl:with-param name="string" select="."/>
            > <xsl:with-param name="old" select="'/'"/>
            > <xsl:with-param name="new"
            select="'/​'"/><!--zero-width space-->
            > </xsl:call-template>
            > ...
            >
            >
            <!--========================================================================-->
            >
            > <!--replace all occurrences of $old by $new in $string-->
            > <xsl:template name="replace">
            > <xsl:param name="string"/>
            > <xsl:param name="old" select="'????????'"/>
            > <xsl:param name="new"/>
            > <xsl:choose>
            > <xsl:when test="contains( $string, $old )">
            > <xsl:value-of select="substring-before( $string, $old )"/>
            > <xsl:value-of select="$new"/>
            > <xsl:call-template name="replace">
            > <xsl:with-param name="string"
            > select="substring-after( $string, $old )"/>
            > <xsl:with-param name="old" select="$old"/>
            > <xsl:with-param name="new" select="$new"/>
            > </xsl:call-template>
            > </xsl:when>
            > <xsl:otherwise>
            > <xsl:value-of select="$string"/>
            > </xsl:otherwise>
            > </xsl:choose>
            > </xsl:template>
            >
            >
            > --
            > Public courses: Spring 2004 world tour of hands-on XSL instruction
            > Next: 3-day XSLT/XPath; 2-day XSL-FO - Birmingham, UK June 14,2004
            >
            > World-wide on-site corporate, govt. & user group XML/XSL training.
            > G. Ken Holman mailto:gkholman@C...
            > Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
            > Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
            > Male Breast Cancer Awareness http://www.CraneSoftwrights.com/f/bc
            > Legal business disclaimers: http://www.CraneSoftwrights.com/legal
          Your message has been successfully submitted and would be delivered to recipients shortly.