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

Checking for html tags

Expand Messages
  • astragh
    Hi to the forum, I am creating an XML from a JSP page using FOP to so that the page can be viewed as a PDF. I have a query regarding parsing html tags that
    Message 1 of 5 , Mar 24, 2005
    • 0 Attachment
      Hi to the forum,

      I am creating an XML from a JSP page using FOP to so that the page
      can be viewed as a PDF.

      I have a query regarding parsing html tags that come through in the
      object i.e. <b> <i> and <u> presently I call on my util.xsl see below:

      <xsl:template name="b">
      <xsl:param name="str"/>
      <xsl:choose>
      <xsl:when test='contains($str,"<b>")'>
      <xsl:variable name="before-first-b"
      select='substring-before($str,"<b>")'/>
      <xsl:variable name="inside-first-b"
      select="substring-before(substring-after
      ($str,'<b>'),'</b>')"/>
      <xsl:variable name="after-first-b"
      select='substring-after($str,"</b>")'/>
      <xsl:value-of select="$before-first-b"/> <fo:inline
      font-weight="bold"><xsl:value-of select="$inside-first-
      b"/></fo:inline>
      <xsl:call-template name="b">
      <xsl:with-param name="str" select="$after-first-b"/>
      </xsl:call-template>
      </xsl:when>
      <xsl:when test='contains($str,"<i>")'>
      <xsl:variable name="before-first-b"
      select='substring-before($str,"<i>")'/>
      <xsl:variable name="inside-first-b"
      select="substring-before(substring-after
      ($str,'<i>'),'</i>')"/>
      <xsl:variable name="after-first-b"
      select='substring-after($str,"</i>")'/>
      <xsl:value-of select="$before-first-b"/> <fo:inline
      font-style="italic"><xsl:value-of select="$inside-first-
      b"/></fo:inline>
      <xsl:call-template name="b">
      <xsl:with-param name="str" select="$after-first-b"/>
      </xsl:call-template>
      </xsl:when>
      <xsl:when test='contains($str,"<u>")'>
      <xsl:variable name="before-first-b"
      select='substring-before($str,"<u>")'/>
      <xsl:variable name="inside-first-b"
      select="substring-before(substring-after
      ($str,'<u>'),'</u>')"/>
      <xsl:variable name="after-first-b"
      select='substring-after($str,"</u>")'/>
      <xsl:value-of select="$before-first-b"/> <fo:inline
      text-decoration="underline"><xsl:value-of select="$inside-first-
      b"/></fo:inline>
      <xsl:call-template name="b">
      <xsl:with-param name="str" select="$after-first-b"/>
      </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
      <xsl:value-of select="$str"/>
      </xsl:otherwise>
      </xsl:choose>
      </xsl:template>

      Which works fine if the order of <b> <i> or <u> is in this order and
      only occurs once, what can I do so that it keeps checking the string
      until complete and also checks for an <i><b>italic bold</b></i> word.

      Many thanks and kind regards,

      -George
    • Victor Vishnyakov
      Why doing double conversion? How about writing JSP that produces XSL-FO directly? Best Regards, Victor Vishnyakov http://xslf-zone.com/
      Message 2 of 5 , Mar 25, 2005
      • 0 Attachment
        Why doing double conversion? How about writing JSP that produces XSL-FO
        directly?


        Best Regards,
        Victor Vishnyakov
        http://xslf-zone.com/



        > -----Original Message-----
        > From: astragh [mailto:rezerection2@...]
        > Sent: Thursday, March 24, 2005 5:07 PM
        > To: XSL-FO@yahoogroups.com
        > Subject: [XSL-FO] Checking for html tags
        >
        >
        >
        > Hi to the forum,
        >
        > I am creating an XML from a JSP page using FOP to so that the
        > page can be viewed as a PDF.
        >
        > I have a query regarding parsing html tags that come through
        > in the object i.e. <b> <i> and <u> presently I call on my
        > util.xsl see below:
        >
        > <xsl:template name="b">
        > <xsl:param name="str"/>
        > <xsl:choose>
        > <xsl:when test='contains($str,"<b>")'>
        > <xsl:variable name="before-first-b"
        > select='substring-before($str,"<b>")'/>
        > <xsl:variable name="inside-first-b"
        > select="substring-before(substring-after
        > ($str,'<b>'),'</b>')"/>
        > <xsl:variable name="after-first-b"
        > select='substring-after($str,"</b>")'/>
        > <xsl:value-of select="$before-first-b"/> <fo:inline
        > font-weight="bold"><xsl:value-of select="$inside-first-
        > b"/></fo:inline>
        > <xsl:call-template name="b">
        > <xsl:with-param name="str" select="$after-first-b"/>
        > </xsl:call-template>
        > </xsl:when>
        > <xsl:when test='contains($str,"<i>")'>
        > <xsl:variable name="before-first-b"
        > select='substring-before($str,"<i>")'/>
        > <xsl:variable name="inside-first-b"
        > select="substring-before(substring-after
        > ($str,'<i>'),'</i>')"/>
        > <xsl:variable name="after-first-b"
        > select='substring-after($str,"</i>")'/>
        > <xsl:value-of select="$before-first-b"/> <fo:inline
        > font-style="italic"><xsl:value-of select="$inside-first-
        > b"/></fo:inline>
        > <xsl:call-template name="b">
        > <xsl:with-param name="str" select="$after-first-b"/>
        > </xsl:call-template>
        > </xsl:when>
        > <xsl:when test='contains($str,"<u>")'>
        > <xsl:variable name="before-first-b"
        > select='substring-before($str,"<u>")'/>
        > <xsl:variable name="inside-first-b"
        > select="substring-before(substring-after
        > ($str,'<u>'),'</u>')"/>
        > <xsl:variable name="after-first-b"
        > select='substring-after($str,"</u>")'/>
        > <xsl:value-of select="$before-first-b"/> <fo:inline
        > text-decoration="underline"><xsl:value-of
        > select="$inside-first- b"/></fo:inline>
        > <xsl:call-template name="b">
        > <xsl:with-param name="str" select="$after-first-b"/>
        > </xsl:call-template>
        > </xsl:when>
        > <xsl:otherwise>
        > <xsl:value-of select="$str"/>
        > </xsl:otherwise>
        > </xsl:choose>
        > </xsl:template>
        >
        > Which works fine if the order of <b> <i> or <u> is in this
        > order and only occurs once, what can I do so that it keeps
        > checking the string until complete and also checks for an
        > <i><b>italic bold</b></i> word.
        >
        > Many thanks and kind regards,
        >
        > -George
        >
        >
        >
        >
        >
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
        >
        >
        >
        >
      • astragh
        Hi Victor Vishnyakov, Many thanks for taking the time to reply... I will go ahead and try what you suggest with my Java DispatchAction class, but was unsure if
        Message 3 of 5 , Mar 25, 2005
        • 0 Attachment
          Hi Victor Vishnyakov,

          Many thanks for taking the time to reply... I will go ahead and try
          what you suggest with my Java DispatchAction class, but was unsure if
          it would parse the XML with the XSL-FO created on the fly.

          -George

          --- In XSL-FO@yahoogroups.com, "Victor Vishnyakov" <tch_@m...> wrote:
          > Why doing double conversion? How about writing JSP that produces
          XSL-FO
          > directly?
          >
          >
          > Best Regards,
          > Victor Vishnyakov
          > http://xslf-zone.com/
          >
          >
          >
          > > -----Original Message-----
          > > From: astragh [mailto:rezerection2@y...]
          > > Sent: Thursday, March 24, 2005 5:07 PM
          > > To: XSL-FO@yahoogroups.com
          > > Subject: [XSL-FO] Checking for html tags
          > >
          > >
          > >
          > > Hi to the forum,
          > >
          > > I am creating an XML from a JSP page using FOP to so that the
          > > page can be viewed as a PDF.
          > >
          > > I have a query regarding parsing html tags that come through
          > > in the object i.e. <b> <i> and <u> presently I call on my
          > > util.xsl see below:
          > >
          > > <xsl:template name="b">
          > > <xsl:param name="str"/>
          > > <xsl:choose>
          > > <xsl:when test='contains($str,"<b>")'>
          > > <xsl:variable name="before-first-b"
          > > select='substring-before
          ($str,"<b>")'/>
          > > <xsl:variable name="inside-first-b"
          > > select="substring-before(substring-after
          > > ($str,'<b>'),'</b>')"/>
          > > <xsl:variable name="after-first-b"
          > > select='substring-after
          ($str,"</b>")'/>
          > > <xsl:value-of select="$before-first-b"/> <fo:inline
          > > font-weight="bold"><xsl:value-of select="$inside-first-
          > > b"/></fo:inline>
          > > <xsl:call-template name="b">
          > > <xsl:with-param name="str" select="$after-first-b"/>
          > > </xsl:call-template>
          > > </xsl:when>
          > > <xsl:when test='contains($str,"<i>")'>
          > > <xsl:variable name="before-first-b"
          > > select='substring-before
          ($str,"<i>")'/>
          > > <xsl:variable name="inside-first-b"
          > > select="substring-before(substring-after
          > > ($str,'<i>'),'</i>')"/>
          > > <xsl:variable name="after-first-b"
          > > select='substring-after
          ($str,"</i>")'/>
          > > <xsl:value-of select="$before-first-b"/> <fo:inline
          > > font-style="italic"><xsl:value-of select="$inside-first-
          > > b"/></fo:inline>
          > > <xsl:call-template name="b">
          > > <xsl:with-param name="str" select="$after-first-b"/>
          > > </xsl:call-template>
          > > </xsl:when>
          > > <xsl:when test='contains($str,"<u>")'>
          > > <xsl:variable name="before-first-b"
          > > select='substring-before
          ($str,"<u>")'/>
          > > <xsl:variable name="inside-first-b"
          > > select="substring-before(substring-after
          > > ($str,'<u>'),'</u>')"/>
          > > <xsl:variable name="after-first-b"
          > > select='substring-after
          ($str,"</u>")'/>
          > > <xsl:value-of select="$before-first-b"/> <fo:inline
          > > text-decoration="underline"><xsl:value-of
          > > select="$inside-first- b"/></fo:inline>
          > > <xsl:call-template name="b">
          > > <xsl:with-param name="str" select="$after-first-b"/>
          > > </xsl:call-template>
          > > </xsl:when>
          > > <xsl:otherwise>
          > > <xsl:value-of select="$str"/>
          > > </xsl:otherwise>
          > > </xsl:choose>
          > > </xsl:template>
          > >
          > > Which works fine if the order of <b> <i> or <u> is in this
          > > order and only occurs once, what can I do so that it keeps
          > > checking the string until complete and also checks for an
          > > <i><b>italic bold</b></i> word.
          > >
          > > Many thanks and kind regards,
          > >
          > > -George
          > >
          > >
          > >
          > >
          > >
          > >
          > > Yahoo! Groups Links
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
          > >
        • astragh
          For some reason my XML has < displayed for which then displays the in the PDF. Any idea why this would be?
          Message 4 of 5 , Mar 25, 2005
          • 0 Attachment
            For some reason my XML has < displayed for < and > for > which
            then displays the <fo:inline font-style="italic"/> in the PDF.

            Any idea why this would be?

            TIA,

            -George

            --- In XSL-FO@yahoogroups.com, "astragh" <rezerection2@y...> wrote:
            >
            > Hi Victor Vishnyakov,
            >
            > Many thanks for taking the time to reply... I will go ahead and try
            > what you suggest with my Java DispatchAction class, but was unsure
            if
            > it would parse the XML with the XSL-FO created on the fly.
            >
            > -George
            >
            > --- In XSL-FO@yahoogroups.com, "Victor Vishnyakov" <tch_@m...>
            wrote:
            > > Why doing double conversion? How about writing JSP that produces
            > XSL-FO
            > > directly?
            > >
            > >
            > > Best Regards,
            > > Victor Vishnyakov
            > > http://xslf-zone.com/
            > >
            > >
            > >
            > > > -----Original Message-----
            > > > From: astragh [mailto:rezerection2@y...]
            > > > Sent: Thursday, March 24, 2005 5:07 PM
            > > > To: XSL-FO@yahoogroups.com
            > > > Subject: [XSL-FO] Checking for html tags
            > > >
            > > >
            > > >
            > > > Hi to the forum,
            > > >
            > > > I am creating an XML from a JSP page using FOP to so that the
            > > > page can be viewed as a PDF.
            > > >
            > > > I have a query regarding parsing html tags that come through
            > > > in the object i.e. <b> <i> and <u> presently I call on my
            > > > util.xsl see below:
            > > >
            > > > <xsl:template name="b">
            > > > <xsl:param name="str"/>
            > > > <xsl:choose>
            > > > <xsl:when test='contains($str,"<b>")'>
            > > > <xsl:variable name="before-first-b"
            > > > select='substring-before
            > ($str,"<b>")'/>
            > > > <xsl:variable name="inside-first-b"
            > > > select="substring-before(substring-after
            > > > ($str,'<b>'),'</b>')"/>
            > > > <xsl:variable name="after-first-b"
            > > > select='substring-after
            > ($str,"</b>")'/>
            > > > <xsl:value-of select="$before-first-
            b"/> <fo:inline
            > > > font-weight="bold"><xsl:value-of select="$inside-first-
            > > > b"/></fo:inline>
            > > > <xsl:call-template name="b">
            > > > <xsl:with-param name="str" select="$after-first-b"/>
            > > > </xsl:call-template>
            > > > </xsl:when>
            > > > <xsl:when test='contains($str,"<i>")'>
            > > > <xsl:variable name="before-first-b"
            > > > select='substring-before
            > ($str,"<i>")'/>
            > > > <xsl:variable name="inside-first-b"
            > > > select="substring-before(substring-after
            > > > ($str,'<i>'),'</i>')"/>
            > > > <xsl:variable name="after-first-b"
            > > > select='substring-after
            > ($str,"</i>")'/>
            > > > <xsl:value-of select="$before-first-
            b"/> <fo:inline
            > > > font-style="italic"><xsl:value-of select="$inside-first-
            > > > b"/></fo:inline>
            > > > <xsl:call-template name="b">
            > > > <xsl:with-param name="str" select="$after-first-b"/>
            > > > </xsl:call-template>
            > > > </xsl:when>
            > > > <xsl:when test='contains($str,"<u>")'>
            > > > <xsl:variable name="before-first-b"
            > > > select='substring-before
            > ($str,"<u>")'/>
            > > > <xsl:variable name="inside-first-b"
            > > > select="substring-before(substring-after
            > > > ($str,'<u>'),'</u>')"/>
            > > > <xsl:variable name="after-first-b"
            > > > select='substring-after
            > ($str,"</u>")'/>
            > > > <xsl:value-of select="$before-first-
            b"/> <fo:inline
            > > > text-decoration="underline"><xsl:value-of
            > > > select="$inside-first- b"/></fo:inline>
            > > > <xsl:call-template name="b">
            > > > <xsl:with-param name="str" select="$after-first-b"/>
            > > > </xsl:call-template>
            > > > </xsl:when>
            > > > <xsl:otherwise>
            > > > <xsl:value-of select="$str"/>
            > > > </xsl:otherwise>
            > > > </xsl:choose>
            > > > </xsl:template>
            > > >
            > > > Which works fine if the order of <b> <i> or <u> is in this
            > > > order and only occurs once, what can I do so that it keeps
            > > > checking the string until complete and also checks for an
            > > > <i><b>italic bold</b></i> word.
            > > >
            > > > Many thanks and kind regards,
            > > >
            > > > -George
            > > >
            > > >
            > > >
            > > >
            > > >
            > > >
            > > > Yahoo! Groups Links
            > > >
            > > >
            > > >
            > > >
            > > >
            > > >
            > > >
            > > >
            > > >
          • astragh
            Found that using DOE (disable output encoding) within the xsl:value- of helps to prevent the > etc from being displayed. ... which ... try ... unsure ...
            Message 5 of 5 , Mar 25, 2005
            • 0 Attachment
              Found that using DOE (disable output encoding) within the xsl:value-
              of helps to prevent the > etc from being displayed.

              --- In XSL-FO@yahoogroups.com, "astragh" <rezerection2@y...> wrote:
              >
              > For some reason my XML has < displayed for < and > for >
              which
              > then displays the <fo:inline font-style="italic"/> in the PDF.
              >
              > Any idea why this would be?
              >
              > TIA,
              >
              > -George
              >
              > --- In XSL-FO@yahoogroups.com, "astragh" <rezerection2@y...> wrote:
              > >
              > > Hi Victor Vishnyakov,
              > >
              > > Many thanks for taking the time to reply... I will go ahead and
              try
              > > what you suggest with my Java DispatchAction class, but was
              unsure
              > if
              > > it would parse the XML with the XSL-FO created on the fly.
              > >
              > > -George
              > >
              > > --- In XSL-FO@yahoogroups.com, "Victor Vishnyakov" <tch_@m...>
              > wrote:
              > > > Why doing double conversion? How about writing JSP that
              produces
              > > XSL-FO
              > > > directly?
              > > >
              > > >
              > > > Best Regards,
              > > > Victor Vishnyakov
              > > > http://xslf-zone.com/
              > > >
              > > >
              > > >
              > > > > -----Original Message-----
              > > > > From: astragh [mailto:rezerection2@y...]
              > > > > Sent: Thursday, March 24, 2005 5:07 PM
              > > > > To: XSL-FO@yahoogroups.com
              > > > > Subject: [XSL-FO] Checking for html tags
              > > > >
              > > > >
              > > > >
              > > > > Hi to the forum,
              > > > >
              > > > > I am creating an XML from a JSP page using FOP to so that the
              > > > > page can be viewed as a PDF.
              > > > >
              > > > > I have a query regarding parsing html tags that come through
              > > > > in the object i.e. <b> <i> and <u> presently I call on my
              > > > > util.xsl see below:
              > > > >
              > > > > <xsl:template name="b">
              > > > > <xsl:param name="str"/>
              > > > > <xsl:choose>
              > > > > <xsl:when test='contains($str,"<b>")'>
              > > > > <xsl:variable name="before-first-b"
              > > > > select='substring-before
              > > ($str,"<b>")'/>
              > > > > <xsl:variable name="inside-first-b"
              > > > > select="substring-before(substring-
              after
              > > > > ($str,'<b>'),'</b>')"/>
              > > > > <xsl:variable name="after-first-b"
              > > > > select='substring-after
              > > ($str,"</b>")'/>
              > > > > <xsl:value-of select="$before-first-
              > b"/> <fo:inline
              > > > > font-weight="bold"><xsl:value-of select="$inside-first-
              > > > > b"/></fo:inline>
              > > > > <xsl:call-template name="b">
              > > > > <xsl:with-param name="str" select="$after-first-
              b"/>
              > > > > </xsl:call-template>
              > > > > </xsl:when>
              > > > > <xsl:when test='contains($str,"<i>")'>
              > > > > <xsl:variable name="before-first-b"
              > > > > select='substring-before
              > > ($str,"<i>")'/>
              > > > > <xsl:variable name="inside-first-b"
              > > > > select="substring-before(substring-
              after
              > > > > ($str,'<i>'),'</i>')"/>
              > > > > <xsl:variable name="after-first-b"
              > > > > select='substring-after
              > > ($str,"</i>")'/>
              > > > > <xsl:value-of select="$before-first-
              > b"/> <fo:inline
              > > > > font-style="italic"><xsl:value-of select="$inside-first-
              > > > > b"/></fo:inline>
              > > > > <xsl:call-template name="b">
              > > > > <xsl:with-param name="str" select="$after-first-
              b"/>
              > > > > </xsl:call-template>
              > > > > </xsl:when>
              > > > > <xsl:when test='contains($str,"<u>")'>
              > > > > <xsl:variable name="before-first-b"
              > > > > select='substring-before
              > > ($str,"<u>")'/>
              > > > > <xsl:variable name="inside-first-b"
              > > > > select="substring-before(substring-
              after
              > > > > ($str,'<u>'),'</u>')"/>
              > > > > <xsl:variable name="after-first-b"
              > > > > select='substring-after
              > > ($str,"</u>")'/>
              > > > > <xsl:value-of select="$before-first-
              > b"/> <fo:inline
              > > > > text-decoration="underline"><xsl:value-of
              > > > > select="$inside-first- b"/></fo:inline>
              > > > > <xsl:call-template name="b">
              > > > > <xsl:with-param name="str" select="$after-first-
              b"/>
              > > > > </xsl:call-template>
              > > > > </xsl:when>
              > > > > <xsl:otherwise>
              > > > > <xsl:value-of select="$str"/>
              > > > > </xsl:otherwise>
              > > > > </xsl:choose>
              > > > > </xsl:template>
              > > > >
              > > > > Which works fine if the order of <b> <i> or <u> is in this
              > > > > order and only occurs once, what can I do so that it keeps
              > > > > checking the string until complete and also checks for an
              > > > > <i><b>italic bold</b></i> word.
              > > > >
              > > > > Many thanks and kind regards,
              > > > >
              > > > > -George
              > > > >
              > > > >
              > > > >
              > > > >
              > > > >
              > > > >
              > > > > Yahoo! Groups Links
              > > > >
              > > > >
              > > > >
              > > > >
              > > > >
              > > > >
              > > > >
              > > > >
              > > > >
            Your message has been successfully submitted and would be delivered to recipients shortly.