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

Re: Apply templates after tags

Expand Messages
  • Devang Parekh
    Thanks that helped to some degree. However, if I have the text node an arbitrary number of nodes under the empty tag how do i go about selecting just that
    Message 1 of 3 , Aug 5, 2003
    • 0 Attachment
      Thanks that helped to some degree. However, if I have the text node
      an arbitrary number of nodes under the empty tag how do i go about
      selecting just that text node and also disregaridng any apply-
      templates that may occur to tags above the empty tag.

      Example:

      <dateline rend="indentdateline"><date value="1876.04.15">
      <handShift new="UN01" old="TS01"/><space extent="1em"/>
      Apl. 15,<handShift new="TS01" old="UN01" rend="preprint"/>
      187<handShift new="UN01" old="TS01"/>6</date>.</dateline>

      Applicable XSL-FO:
      <xsl:template match="*[@rend='indentdateline']">
      <fo:block text-indent="19em"><xsl:apply-templates/></fo:block>
      </xsl:template>

      With the current method(method suggested below) I get a blue 6 and a
      black 6 rather than just a blue 6. Also the Apl. 15 does not change
      to blue.

      Devang Parekh
      jenkinsear@...

      --- In XSL-FO@yahoogroups.com, "G. Ken Holman" <gkholman@c...> wrote:
      > At 2003-07-10 17:54 +0000, Devang Parekh wrote:
      > >The xml markup looks like the following:
      > ><blah attr="blue"/>text goes here<blah attr="black/>more text here
      > >
      > >What is the best way of applying templates to text between the
      closed
      > >tags?
      >
      > You don't describe any other rules, so I'm assuming that you just
      want,
      > say, an inline construct for each <blah> to contain the immediately
      > following text and nothing else.
      >
      > If this is true, then you can use:
      >
      > ...
      > <xsl:apply-templates select="blah"/><!--don't push text nodes-->
      > ...
      >
      > <xsl:template match="blah"><!--enclose following text in an
      inline-->
      > <inlne color="{@attr}">
      > <xsl:value-of select="following-sibling::node()[1][self::text
      ()]"/>
      > </inline>
      > </xsl:template>
      >
      > The expression is in effect saying "get the value of the
      immediately
      > following sibling node, only if it is a text node". It is better
      than
      > asking for the immediately following text node just in case you
      have two
      > <blah/> elements adjacent to each other.
      >
      > I hope this helps.
      >
      > ................... Ken
      >
      > --
      > Upcoming hands-on courses: in-house corporate training available;
      > North America public: XSL-FO Aug 4,2003; XSLT/XPath Aug 12, 2003
      >
      > 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)
      > ISBN 0-13-065196-6 Definitive XSLT and XPath
      > ISBN 0-13-140374-5 Definitive XSL-FO
      > ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
      > ISBN 1-894049-11-X Practical Formatting Using XSL-FO
      > Member of the XML Guild of Practitioners: http://XMLGuild.info
      > Male Breast Cancer Awareness http://www.CraneSoftwrights.com/f/bc
    Your message has been successfully submitted and would be delivered to recipients shortly.