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

Re: [XSL-FO] Params

Expand Messages
  • Ovidiu Pop
    Hey Chuck, First your question is related to XSLT not to XSLT-FO. You have there 2 types of parameters: stylesheet params - declared in the document root
    Message 1 of 5 , Feb 5, 2003
    • 0 Attachment
      Hey Chuck,

      First your question is related to XSLT not to XSLT-FO.

      You have there 2 types of parameters:

      stylesheet params - declared in the document root
      template params - declared in the template

      In order to use template params, they should be
      declared inside the template.
      If you want to use the stylesheet params, just refer
      them.

      When you call a template with params, you should
      provide values for those params where that template is
      called.
      I see you didn't provide those values for the last
      template call.

      It would be a better idea to name stylesheet params
      different than template params.

      I hope you got the idea.
      Ovi

      --- "Hallman, Chuck (NIH/NIEHS)"
      <hallman1@...> wrote:
      > 1. I have defined some parameters globally
      >
      > <xsl:param name="startCol"/>
      > <xsl:param name="endCol"/>
      > <xsl:param name="gender"/>
      >
      > 2. I invoke a template like this passing the
      > parameters ...
      >
      > <xsl:apply-templates select="//subheader">
      > <xsl:with-param
      > name="startCol">1</xsl:with-param>
      > <xsl:with-param
      > name="endCol">6</xsl:with-param>
      > <xsl:with-param
      > name="gender">female</xsl:with-param>
      > </xsl:apply-templates>
      >
      > 3. Receiving template looks like this and my
      > parameters are available and
      > correct ...
      >
      > <xsl:template match="subheader">
      > <xsl:param name="startCol"/> <- contains 1
      > <xsl:param name="endCol"/> <-- contains 6
      > <xsl:param name="gender"/> <- contains female
      >
      >
      > 4. When I try to pass the params to yet another
      > template they do not show up
      > ...
      >
      > <xsl:if test="$gender='female'">
      > <xsl:apply-templates select="//detail/female">
      > <xsl:with-param name="startCol"/>
      > <xsl:with-param name="endCol"/>
      > <xsl:with-param name="gender"/>
      > </xsl:apply-templates>
      > </xsl:if>
      >
      > Questions:
      >
      > - I know I must be doing something stupid but I
      > can't figure out what it is
      > ... Any ideas out there?
      > - Do you have to declare your parameters in every
      > 'receiving' template for
      > them to be available?
      >
      >
      >
      > [Non-text portions of this message have been
      > removed]
      >
      >


      __________________________________________________
      Do you Yahoo!?
      Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
      http://mailplus.yahoo.com
    • Hallman, Chuck (NIH/NIEHS)
      Thanks for your help. What I can t seem to get thru my thick head is how to pass the param values along to another template .. For example when I use a select=
      Message 2 of 5 , Feb 5, 2003
      • 0 Attachment
        Thanks for your help. What I can't seem to get thru my thick head is how to
        pass the param values along to another template ..
        For example when I use a select= to pass the SAME parameter values along to
        another template they do not show up in the second called template ... see
        red selection below .. what I need is to be able to set these parameters ONE
        time and use them in several different templates ...

        > <xsl:template match="subheader">
        > <xsl:param name="startCol"/> <- contains 1
        > <xsl:param name="endCol"/> <-- contains 6
        > <xsl:param name="gender"/> <- contains female

        <xsl:if test="$gender='female'">
        > <xsl:apply-templates select="//detail/female">
        > <xsl:with-param name="startCol" select="$startCol"/> <-- these do not
        show up
        > <xsl:with-param name="endCol" select="$endCol"/>
        > <xsl:with-param name="gender" select="$gender"/>
        > </xsl:apply-templates>
        ></xsl:if>

        -----Original Message-----
        From: Ovidiu Pop [mailto:ov1one@...]
        Sent: Wednesday, February 05, 2003 1:03 PM
        To: XSL-FO@yahoogroups.com
        Subject: Re: [XSL-FO] Params


        Hey Chuck,

        First your question is related to XSLT not to XSLT-FO.

        You have there 2 types of parameters:

        stylesheet params - declared in the document root
        template params - declared in the template

        In order to use template params, they should be
        declared inside the template.
        If you want to use the stylesheet params, just refer
        them.

        When you call a template with params, you should
        provide values for those params where that template is
        called.
        I see you didn't provide those values for the last
        template call.

        It would be a better idea to name stylesheet params
        different than template params.

        I hope you got the idea.
        Ovi

        --- "Hallman, Chuck (NIH/NIEHS)"
        <hallman1@...> wrote:
        > 1. I have defined some parameters globally
        >
        > <xsl:param name="startCol"/>
        > <xsl:param name="endCol"/>
        > <xsl:param name="gender"/>
        >
        > 2. I invoke a template like this passing the
        > parameters ...
        >
        > <xsl:apply-templates select="//subheader">
        > <xsl:with-param
        > name="startCol">1</xsl:with-param>
        > <xsl:with-param
        > name="endCol">6</xsl:with-param>
        > <xsl:with-param
        > name="gender">female</xsl:with-param>
        > </xsl:apply-templates>
        >
        > 3. Receiving template looks like this and my
        > parameters are available and
        > correct ...
        >
        > <xsl:template match="subheader">
        > <xsl:param name="startCol"/> <- contains 1
        > <xsl:param name="endCol"/> <-- contains 6
        > <xsl:param name="gender"/> <- contains female
        >
        >
        > 4. When I try to pass the params to yet another
        > template they do not show up
        > ...
        >
        > <xsl:if test="$gender='female'">
        > <xsl:apply-templates select="//detail/female">
        > <xsl:with-param name="startCol"/>
        > <xsl:with-param name="endCol"/>
        > <xsl:with-param name="gender"/>
        > </xsl:apply-templates>
        > </xsl:if>
        >
        > Questions:
        >
        > - I know I must be doing something stupid but I
        > can't figure out what it is
        > ... Any ideas out there?
        > - Do you have to declare your parameters in every
        > 'receiving' template for
        > them to be available?
        >
        >
        >
        > [Non-text portions of this message have been
        > removed]
        >
        >


        __________________________________________________
        Do you Yahoo!?
        Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
        http://mailplus.yahoo.com <http://mailplus.yahoo.com>

        To unsubscribe from this group, send an email to:
        XSL-FO-unsubscribe@egroups.com



        Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
        <http://docs.yahoo.com/info/terms/> .




        [Non-text portions of this message have been removed]
      • Ovidiu Pop
        Hey Chuck, I ve read the book, and the book says: In the case of the parameter value is available in each of the
        Message 3 of 5 , Feb 6, 2003
        • 0 Attachment
          Hey Chuck,

          I've read the book, and the book says:

          In the case of
          <xsl:apply-templates><xsl:with-param...> the parameter
          value is available in each of the templates that is
          called (one per selected node). The parameter is
          effectively evaluated once only - it will have the
          same value for each of these templates.


          The <xsl:with-param> element does not actually declare
          a variable, so there is no problem if the name is the
          same as that of a variable that is currently in scope.
          So you can have this:
          <xsl:with-param name="startCol" select="$startCol"/>

          Remember that variables cannot be updated. You have to
          use recursive calls and parameters to make updates.

          I hope this give you some light in your problem.

          Ovi


          --- "Hallman, Chuck (NIH/NIEHS)"
          <hallman1@...> wrote:
          > Thanks for your help. What I can't seem to get thru
          > my thick head is how to
          > pass the param values along to another template ..
          > For example when I use a select= to pass the SAME
          > parameter values along to
          > another template they do not show up in the second
          > called template ... see
          > red selection below .. what I need is to be able to
          > set these parameters ONE
          > time and use them in several different templates ...
          >
          > > <xsl:template match="subheader">
          > > <xsl:param name="startCol"/> <- contains 1
          > > <xsl:param name="endCol"/> <-- contains 6
          > > <xsl:param name="gender"/> <- contains female
          >
          > <xsl:if test="$gender='female'">
          > > <xsl:apply-templates select="//detail/female">
          > > <xsl:with-param name="startCol"
          > select="$startCol"/> <-- these do not
          > show up
          > > <xsl:with-param name="endCol"
          > select="$endCol"/>
          > > <xsl:with-param name="gender"
          > select="$gender"/>
          > > </xsl:apply-templates>
          > ></xsl:if>
          >
          > -----Original Message-----
          > From: Ovidiu Pop [mailto:ov1one@...]
          > Sent: Wednesday, February 05, 2003 1:03 PM
          > To: XSL-FO@yahoogroups.com
          > Subject: Re: [XSL-FO] Params
          >
          >
          > Hey Chuck,
          >
          > First your question is related to XSLT not to
          > XSLT-FO.
          >
          > You have there 2 types of parameters:
          >
          > stylesheet params - declared in the document root
          > template params - declared in the template
          >
          > In order to use template params, they should be
          > declared inside the template.
          > If you want to use the stylesheet params, just refer
          > them.
          >
          > When you call a template with params, you should
          > provide values for those params where that template
          > is
          > called.
          > I see you didn't provide those values for the last
          > template call.
          >
          > It would be a better idea to name stylesheet params
          > different than template params.
          >
          > I hope you got the idea.
          > Ovi
          >
          > --- "Hallman, Chuck (NIH/NIEHS)"
          > <hallman1@...> wrote:
          > > 1. I have defined some parameters globally
          > >
          > > <xsl:param name="startCol"/>
          > > <xsl:param name="endCol"/>
          > > <xsl:param name="gender"/>
          > >
          > > 2. I invoke a template like this passing the
          > > parameters ...
          > >
          > > <xsl:apply-templates select="//subheader">
          > > <xsl:with-param
          > > name="startCol">1</xsl:with-param>
          > > <xsl:with-param
          > > name="endCol">6</xsl:with-param>
          > > <xsl:with-param
          > > name="gender">female</xsl:with-param>
          > > </xsl:apply-templates>
          > >
          > > 3. Receiving template looks like this and my
          > > parameters are available and
          > > correct ...
          > >
          > > <xsl:template match="subheader">
          > > <xsl:param name="startCol"/> <- contains 1
          > > <xsl:param name="endCol"/> <-- contains 6
          > > <xsl:param name="gender"/> <- contains female
          > >
          > >
          > > 4. When I try to pass the params to yet another
          > > template they do not show up
          > > ...
          > >
          > > <xsl:if test="$gender='female'">
          > > <xsl:apply-templates select="//detail/female">
          > > <xsl:with-param name="startCol"/>
          > > <xsl:with-param name="endCol"/>
          > > <xsl:with-param name="gender"/>
          > > </xsl:apply-templates>
          > > </xsl:if>
          > >
          > > Questions:
          > >
          > > - I know I must be doing something stupid but I
          > > can't figure out what it is
          > > ... Any ideas out there?
          > > - Do you have to declare your parameters in every
          > > 'receiving' template for
          > > them to be available?
          > >
          > >
          > >
          > > [Non-text portions of this message have been
          > > removed]
          > >
          > >
          >
          >
          > __________________________________________________
          > Do you Yahoo!?
          > Yahoo! Mail Plus - Powerful. Affordable. Sign up
          > now.
          > http://mailplus.yahoo.com
          > <http://mailplus.yahoo.com>
          >
          > To unsubscribe from this group, send an email to:
          > XSL-FO-unsubscribe@egroups.com
          >
          >
          >
          > Your use of Yahoo! Groups is subject to the Yahoo!
          > Terms of Service
          > <http://docs.yahoo.com/info/terms/> .
          >
          >
          >
          >
          > [Non-text portions of this message have been
          > removed]
          >
          >


          __________________________________________________
          Do you Yahoo!?
          Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
          http://mailplus.yahoo.com
        • Hallman, Chuck (NIH/NIEHS)
          Thank you very much! This does help .. ... From: Ovidiu Pop [mailto:ov1one@yahoo.com] Sent: Thursday, February 06, 2003 5:02 AM To: XSL-FO@yahoogroups.com
          Message 4 of 5 , Feb 6, 2003
          • 0 Attachment
            Thank you very much! This does help ..

            -----Original Message-----
            From: Ovidiu Pop [mailto:ov1one@...]
            Sent: Thursday, February 06, 2003 5:02 AM
            To: XSL-FO@yahoogroups.com
            Subject: RE: [XSL-FO] Params


            Hey Chuck,

            I've read the book, and the book says:

            In the case of
            <xsl:apply-templates><xsl:with-param...> the parameter
            value is available in each of the templates that is
            called (one per selected node). The parameter is
            effectively evaluated once only - it will have the
            same value for each of these templates.


            The <xsl:with-param> element does not actually declare
            a variable, so there is no problem if the name is the
            same as that of a variable that is currently in scope.
            So you can have this:
            <xsl:with-param name="startCol" select="$startCol"/>

            Remember that variables cannot be updated. You have to
            use recursive calls and parameters to make updates.

            I hope this give you some light in your problem.

            Ovi


            --- "Hallman, Chuck (NIH/NIEHS)"
            <hallman1@...> wrote:
            > Thanks for your help. What I can't seem to get thru
            > my thick head is how to
            > pass the param values along to another template ..
            > For example when I use a select= to pass the SAME
            > parameter values along to
            > another template they do not show up in the second
            > called template ... see
            > red selection below .. what I need is to be able to
            > set these parameters ONE
            > time and use them in several different templates ...
            >
            > > <xsl:template match="subheader">
            > > <xsl:param name="startCol"/> <- contains 1
            > > <xsl:param name="endCol"/> <-- contains 6
            > > <xsl:param name="gender"/> <- contains female
            >
            > <xsl:if test="$gender='female'">
            > > <xsl:apply-templates select="//detail/female">
            > > <xsl:with-param name="startCol"
            > select="$startCol"/> <-- these do not
            > show up
            > > <xsl:with-param name="endCol"
            > select="$endCol"/>
            > > <xsl:with-param name="gender"
            > select="$gender"/>
            > > </xsl:apply-templates>
            > ></xsl:if>
            >
            > -----Original Message-----
            > From: Ovidiu Pop [mailto:ov1one@...]
            > Sent: Wednesday, February 05, 2003 1:03 PM
            > To: XSL-FO@yahoogroups.com
            > Subject: Re: [XSL-FO] Params
            >
            >
            > Hey Chuck,
            >
            > First your question is related to XSLT not to
            > XSLT-FO.
            >
            > You have there 2 types of parameters:
            >
            > stylesheet params - declared in the document root
            > template params - declared in the template
            >
            > In order to use template params, they should be
            > declared inside the template.
            > If you want to use the stylesheet params, just refer
            > them.
            >
            > When you call a template with params, you should
            > provide values for those params where that template
            > is
            > called.
            > I see you didn't provide those values for the last
            > template call.
            >
            > It would be a better idea to name stylesheet params
            > different than template params.
            >
            > I hope you got the idea.
            > Ovi
            >
            > --- "Hallman, Chuck (NIH/NIEHS)"
            > <hallman1@...> wrote:
            > > 1. I have defined some parameters globally
            > >
            > > <xsl:param name="startCol"/>
            > > <xsl:param name="endCol"/>
            > > <xsl:param name="gender"/>
            > >
            > > 2. I invoke a template like this passing the
            > > parameters ...
            > >
            > > <xsl:apply-templates select="//subheader">
            > > <xsl:with-param
            > > name="startCol">1</xsl:with-param>
            > > <xsl:with-param
            > > name="endCol">6</xsl:with-param>
            > > <xsl:with-param
            > > name="gender">female</xsl:with-param>
            > > </xsl:apply-templates>
            > >
            > > 3. Receiving template looks like this and my
            > > parameters are available and
            > > correct ...
            > >
            > > <xsl:template match="subheader">
            > > <xsl:param name="startCol"/> <- contains 1
            > > <xsl:param name="endCol"/> <-- contains 6
            > > <xsl:param name="gender"/> <- contains female
            > >
            > >
            > > 4. When I try to pass the params to yet another
            > > template they do not show up
            > > ...
            > >
            > > <xsl:if test="$gender='female'">
            > > <xsl:apply-templates select="//detail/female">
            > > <xsl:with-param name="startCol"/>
            > > <xsl:with-param name="endCol"/>
            > > <xsl:with-param name="gender"/>
            > > </xsl:apply-templates>
            > > </xsl:if>
            > >
            > > Questions:
            > >
            > > - I know I must be doing something stupid but I
            > > can't figure out what it is
            > > ... Any ideas out there?
            > > - Do you have to declare your parameters in every
            > > 'receiving' template for
            > > them to be available?
            > >
            > >
            > >
            > > [Non-text portions of this message have been
            > > removed]
            > >
            > >
            >
            >
            > __________________________________________________
            > Do you Yahoo!?
            > Yahoo! Mail Plus - Powerful. Affordable. Sign up
            > now.
            > http://mailplus.yahoo.com <http://mailplus.yahoo.com>
            > < http://mailplus.yahoo.com <http://mailplus.yahoo.com> >
            >
            > To unsubscribe from this group, send an email to:
            > XSL-FO-unsubscribe@egroups.com
            >
            >
            >
            > Your use of Yahoo! Groups is subject to the Yahoo!
            > Terms of Service
            > < http://docs.yahoo.com/info/terms/ <http://docs.yahoo.com/info/terms/> >
            .
            >
            >
            >
            >
            > [Non-text portions of this message have been
            > removed]
            >
            >


            __________________________________________________
            Do you Yahoo!?
            Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
            http://mailplus.yahoo.com <http://mailplus.yahoo.com>

            To unsubscribe from this group, send an email to:
            XSL-FO-unsubscribe@egroups.com



            Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
            <http://docs.yahoo.com/info/terms/> .




            [Non-text portions of this message have been removed]
          Your message has been successfully submitted and would be delivered to recipients shortly.