XSLT Extension Objects and Node Sets

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Matt

    #1

    XSLT Extension Objects and Node Sets

    I need help with passing a generated node set from a style sheet into my customer msxsl extension. I have the following node set that I am creating:

    <xsl:variable name="sql">
    <SQL>
    <StoredProc>spG etReconID</StoredProc>
    <Parms>
    <parm>
    <name>@tran</name>
    <value>956</value>
    </parm>
    <parm>
    <name>@refnbr </name>
    <value><xsl:val ue-of select="$shipnb r"/></value>
    </parm>
    <parm>
    <name>@keyfld </name>
    <value><xsl:val ue-of select="$ponbr"/></value>
    </parm>
    </Parms>
    </SQL>
    </xsl:variable>
    <xsl:value-of select="user:Ge tDBValue('myDB' , msxsl:node-set($sql))"/>

    The return value is just a string as we only want to return a single value. The above code is inside a template and that is why we execute the user function with only a value-of statement. We are trying to create a generic type function that is why we are trying to use the node-set to allow future flexibility. When we receive the node-set in the extended function we only see the XML that was passed to the style sheet and not the above node-set. Does anyonen have a sample they can share on how to get this working?

    Thanks,

    Matt


  • Dimitre Novatchev

    #2
    Re: XSLT Extension Objects and Node Sets

    Too little information is provided to engage in an answer...


    Cheers,
    Dimitre Novatchev
    "Matt" <mdframe@sorviv e.DONT-SEND-SPAM.com> wrote in message news:%23XVvIfB3 FHA.744@TK2MSFT NGP10.phx.gbl.. .
    I need help with passing a generated node set from a style sheet into my customer msxsl extension. I have the following node set that I am creating:

    <xsl:variable name="sql">
    <SQL>
    <StoredProc>spG etReconID</StoredProc>
    <Parms>
    <parm>
    <name>@tran</name>
    <value>956</value>
    </parm>
    <parm>
    <name>@refnbr </name>
    <value><xsl:val ue-of select="$shipnb r"/></value>
    </parm>
    <parm>
    <name>@keyfld </name>
    <value><xsl:val ue-of select="$ponbr"/></value>
    </parm>
    </Parms>
    </SQL>
    </xsl:variable>
    <xsl:value-of select="user:Ge tDBValue('myDB' , msxsl:node-set($sql))"/>

    The return value is just a string as we only want to return a single value. The above code is inside a template and that is why we execute the user function with only a value-of statement. We are trying to create a generic type function that is why we are trying to use the node-set to allow future flexibility. When we receive the node-set in the extended function we only see the XML that was passed to the style sheet and not the above node-set. Does anyonen have a sample they can share on how to get this working?

    Thanks,

    Matt


    Comment

    • Matt

      #3
      Re: XSLT Extension Objects and Node Sets

      Sorry, I don't know how to describe the issue further. What information are
      you looking for?

      I have a .Net object I pass in as an URN with defined XSLT extensions and
      then they are called from the style sheet. I create the node as outlined in
      the original problem and execute the user function as shown in the sample.

      "Dimitre Novatchev" <dimitren@tpg.c om.au> wrote in message
      news:4362f860$0 $21067$892e7fe2 @authen.white.r eadfreenews.net ...
      Too little information is provided to engage in an answer...


      Cheers,
      Dimitre Novatchev
      "Matt" <mdframe@sorviv e.DONT-SEND-SPAM.com> wrote in message
      news:%23XVvIfB3 FHA.744@TK2MSFT NGP10.phx.gbl.. .
      I need help with passing a generated node set from a style sheet into my
      customer msxsl extension. I have the following node set that I am creating:

      <xsl:variable name="sql">
      <SQL>
      <StoredProc>spG etReconID</StoredProc>
      <Parms>
      <parm>
      <name>@tran</name>
      <value>956</value>
      </parm>
      <parm>
      <name>@refnbr </name>
      <value><xsl:val ue-of select="$shipnb r"/></value>
      </parm>
      <parm>
      <name>@keyfld </name>
      <value><xsl:val ue-of select="$ponbr"/></value>
      </parm>
      </Parms>
      </SQL>
      </xsl:variable>
      <xsl:value-of select="user:Ge tDBValue('myDB' , msxsl:node-set($sql))"/>

      The return value is just a string as we only want to return a single
      value. The above code is inside a template and that is why we execute the
      user function with only a value-of statement. We are trying to create a
      generic type function that is why we are trying to use the node-set to allow
      future flexibility. When we receive the node-set in the extended function
      we only see the XML that was passed to the style sheet and not the above
      node-set. Does anyonen have a sample they can share on how to get this
      working?

      Thanks,

      Matt



      Comment

      • Dimitre Novatchev

        #4
        Re: XSLT Extension Objects and Node Sets

        In particular, I don't understand the following sentence:

        "When we receive the node-set in the extended function we only see the XML
        that was passed to the style sheet and not the above node-set."

        In order to understand what really is happening and then try to explain it,
        it would be necessary to provide a complete (but the minimal possible)
        source-code that reproduces the strange behaviour.

        The code provided in the previous messages seems OK to me and therefore is
        insufficient to provide the cause of the strange behaviour -- it must be in
        code, which you haven't shown.

        Cheers,
        Dimitre Novatchev


        "Matt" <mdframe@sorviv e.DONT-SEND-SPAM.com> wrote in message
        news:OYUpPHE3FH A.636@TK2MSFTNG P10.phx.gbl...[color=blue]
        > Sorry, I don't know how to describe the issue further. What information
        > are you looking for?
        >
        > I have a .Net object I pass in as an URN with defined XSLT extensions and
        > then they are called from the style sheet. I create the node as outlined
        > in the original problem and execute the user function as shown in the
        > sample.
        >
        > "Dimitre Novatchev" <dimitren@tpg.c om.au> wrote in message
        > news:4362f860$0 $21067$892e7fe2 @authen.white.r eadfreenews.net ...
        > Too little information is provided to engage in an answer...
        >
        >
        > Cheers,
        > Dimitre Novatchev
        > "Matt" <mdframe@sorviv e.DONT-SEND-SPAM.com> wrote in message
        > news:%23XVvIfB3 FHA.744@TK2MSFT NGP10.phx.gbl.. .
        > I need help with passing a generated node set from a style sheet into my
        > customer msxsl extension. I have the following node set that I am
        > creating:
        >
        > <xsl:variable name="sql">
        > <SQL>
        > <StoredProc>spG etReconID</StoredProc>
        > <Parms>
        > <parm>
        > <name>@tran</name>
        > <value>956</value>
        > </parm>
        > <parm>
        > <name>@refnbr </name>
        > <value><xsl:val ue-of select="$shipnb r"/></value>
        > </parm>
        > <parm>
        > <name>@keyfld </name>
        > <value><xsl:val ue-of select="$ponbr"/></value>
        > </parm>
        > </Parms>
        > </SQL>
        > </xsl:variable>
        > <xsl:value-of select="user:Ge tDBValue('myDB' , msxsl:node-set($sql))"/>
        >
        > The return value is just a string as we only want to return a single
        > value. The above code is inside a template and that is why we execute the
        > user function with only a value-of statement. We are trying to create a
        > generic type function that is why we are trying to use the node-set to
        > allow future flexibility. When we receive the node-set in the extended
        > function we only see the XML that was passed to the style sheet and not
        > the above node-set. Does anyonen have a sample they can share on how to
        > get this working?
        >
        > Thanks,
        >
        > Matt
        >
        >
        >[/color]


        Comment

        • Oleg Tkachenko [MVP]

          #5
          Re: XSLT Extension Objects and Node Sets

          Chances are you don't call MoveNext() on passed XPathNodeIterat or - show
          us how what do you do in your function.

          --
          Oleg Tkachenko [XML MVP, MCAD]
          http://www.XmlLab.Net | http://www.XLinq.Net | http://blog.tkachenko.com

          Matt wrote:[color=blue]
          > I need help with passing a generated node set from a style sheet into my
          > customer msxsl extension. I have the following node set that I am creating:
          >
          > <xsl:variable name="sql">
          > <SQL>
          > <StoredProc>spG etReconID</StoredProc>
          > <Parms>
          > <parm>
          > <name>@tran</name>
          > <value>956</value>
          > </parm>
          > <parm>
          > <name>@refnbr </name>
          > <value><xsl:val ue-of select="$shipnb r"/></value>
          > </parm>
          > <parm>
          > <name>@keyfld </name>
          > <value><xsl:val ue-of select="$ponbr"/></value>
          > </parm>
          > </Parms>
          > </SQL>
          > </xsl:variable>
          > <xsl:value-of select="user:Ge tDBValue('myDB' , msxsl:node-set($sql))"/>
          >
          > The return value is just a string as we only want to return a single
          > value. The above code is inside a template and that is why we execute
          > the user function with only a value-of statement. We are trying to
          > create a generic type function that is why we are trying to use the
          > node-set to allow future flexibility. When we receive the node-set in
          > the extended function we only see the XML that was passed to the style
          > sheet and not the above node-set. Does anyonen have a sample they can
          > share on how to get this working?
          >
          > Thanks,
          >
          > Matt
          >
          >[/color]

          Comment

          • Oleg Tkachenko [MVP]

            #6
            Re: XSLT Extension Objects and Node Sets

            Matt wrote:[color=blue]
            > When we receive the node-set in
            > the extended function we only see the XML that was passed to the style
            > sheet and not the above node-set.[/color]

            That's really weird. In an extension function you only can get what is
            passed as function arguments.

            --
            Oleg Tkachenko [XML MVP, MCAD]
            http://www.XmlLab.Net | http://www.XLinq.Net | http://blog.tkachenko.com

            Comment

            Working...