XSLT xpath call-template problem with double quotes - Framework and Interface Programming

This is a discussion on XSLT xpath call-template problem with double quotes - Framework and Interface Programming ; Hey boys and girls, I ran into a bit of a piccle with the mapper. I''m writing a custom xslt fuctoid and taking in an xpath as a parameter. The problem is that when I connect the functoid with an ...

+ Reply to Thread
Page 1 of 9 1 2 3 ... LastLast
Results 1 to 10 of 90

XSLT xpath call-template problem with double quotes

  1. Default XSLT xpath call-template problem with double quotes

    Hey boys and girls,



    I ran into a bit of a piccle with the mapper. I''m writing a custom xslt
    fuctoid and taking in an xpath as a parameter.

    The problem is that when I connect the functoid with an element in the
    mapper, it generates double quotes around the

    parameters. Then, when I run a value-of statement on the xpath parameter I
    get the xpath statement, not the value of the evaluation! The problem turns
    out to be the double quotes. I created an exampel that runs in xmlspy and it
    works the same way. It works with single quotes but not with double. I can't
    do anything about the call unfortunately, what I can effect is the
    XpathLookupFunctoid template below.

    What I need is a way to convince the value-of statement to evalutate the
    statement instead of just outputting the xpath statemenat by itself.

    I tryed all kinds of tricks that I could emagine including substrings and
    variables. It seems that the string becomes a totally different animal once
    it gets double quoted.

    Below is the xmlspy sample you can run in xmlspy. If the extra quote sight
    on the xpath parameter in the call-template statement is removed it works
    fine. But since that's generated by Biztalk I cant do anything about it so
    the
    manipulation needs to be done in XpathLookupFunctoid:

    Below is the xmlspy compatible example:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">




    <xsl:template match="/">
    <xsl:call-template name="XpathLookupFunctoid">
    <xsl:with-param name="searchparam" select="9" />
    <xsl:with-param name="targetnodename"
    select="&quot;Name2&quot;" />
    <xsl:with-param name="xpath"
    select="&quot;(//*[local-name()='dtParParty' and
    PartyTypeCode=9]/Shortname)[1]&quot;" />
    <xsl:with-param name="defaultvalue" select="&quot;NPs
    Default value&quot;" />
    </xsl:call-template>

    </xsl:template>

    <xsl:template name="XpathLookupFunctoid">
    <xslaram name="searchparam" />
    <xslaram name="targetnodename" />
    <xslaram name="xpath" />
    <xslaram name="defaultvalue" />

    <xsl:variable name="ren" select="$xpath"/>

    <xsl:element name="{$targetnodename}">
    Resultat: <xsl:value-of select="$ren"/>
    </xsl:element>
    </xsl:template>

    </xsl:stylesheet>



    Greatfull for all ideas


    Niklas Pettersson
    Karlstad, Sweden








  2. Default Re: XSLT xpath call-template problem with double quotes

    Nik schrieb:
    > Hey boys and girls,
    >
    >
    >
    > I ran into a bit of a piccle with the mapper. I''m writing a custom xslt
    > fuctoid and taking in an xpath as a parameter.
    >
    > The problem is that when I connect the functoid with an element in the
    > mapper, it generates double quotes around the
    > ...


    XSLT is a compiled language. You can't put XPath expressions into
    strings and let them be evaluated (in absence of extension functions for
    that purpose, but those are not part of the spec).

    Best regards, Julian

  3. Default Re: XSLT xpath call-template problem with double quotes

    I'm not sure that's the problem Julian, xsl:with-param's select attribute
    accepts an XPath expression. The trouble is the expression being passed has
    an spurious pair of quotes:
    <xsl:with-param name="targetnodename" select="&quot;Name2&quot;" />

    I haven't done any custom functoids in BizTalk, perhaps someone on one of
    the BizTalk groups may be able to help.


    --

    Joe Fawcett (MVP - XML)

    http://joe.fawcett.name


    "Julian F. Reschke" <julian.reschke@nospam-greenbytes.de> wrote in message
    news:%23FJP4BCJHHA.1248@TK2MSFTNGP02.phx.gbl...
    > Nik schrieb:
    >> Hey boys and girls,
    >>
    >>
    >>
    >> I ran into a bit of a piccle with the mapper. I''m writing a custom xslt
    >> fuctoid and taking in an xpath as a parameter.
    >>
    >> The problem is that when I connect the functoid with an element in the
    >> mapper, it generates double quotes around the
    >> ...

    >
    > XSLT is a compiled language. You can't put XPath expressions into strings
    > and let them be evaluated (in absence of extension functions for that
    > purpose, but those are not part of the spec).
    >
    > Best regards, Julian




  4. Default Re: XSLT xpath call-template problem with double quotes

    Hi Julian,
    The sample does work without the extra quote. Good ol value-of select works
    fine on xpath statements stored in variables. The thing is that something
    seems to happen with the string when it is surrounded by the double quotes.
    I've been shaking the box all kinds of ways but it seems like the string
    gets saved in another datatype or something under the hood. It really feels
    like there is something fishy going on down in the cellar here...


    "Julian F. Reschke" <julian.reschke@nospam-greenbytes.de> wrote in message
    news:%23FJP4BCJHHA.1248@TK2MSFTNGP02.phx.gbl...
    > Nik schrieb:
    >> Hey boys and girls,
    >>
    >>
    >>
    >> I ran into a bit of a piccle with the mapper. I''m writing a custom xslt
    >> fuctoid and taking in an xpath as a parameter.
    >>
    >> The problem is that when I connect the functoid with an element in the
    >> mapper, it generates double quotes around the
    >> ...

    >
    > XSLT is a compiled language. You can't put XPath expressions into strings
    > and let them be evaluated (in absence of extension functions for that
    > purpose, but those are not part of the spec).
    >
    > Best regards, Julian

    "Julian F. Reschke" <julian.reschke@nospam-greenbytes.de> wrote in message
    news:%23FJP4BCJHHA.1248@TK2MSFTNGP02.phx.gbl...
    > Nik schrieb:
    >> Hey boys and girls,
    >>
    >>
    >>
    >> I ran into a bit of a piccle with the mapper. I''m writing a custom xslt
    >> fuctoid and taking in an xpath as a parameter.
    >>
    >> The problem is that when I connect the functoid with an element in the
    >> mapper, it generates double quotes around the
    >> ...

    >
    > XSLT is a compiled language. You can't put XPath expressions into strings
    > and let them be evaluated (in absence of extension functions for that
    > purpose, but those are not part of the spec).
    >
    > Best regards, Julian




  5. Default Re: XSLT xpath call-template problem with double quotes

    Hi Joe, Yepp that it. Withouth the double quotes it works fine. It seems
    like the result of passing in the double quoted string seems to result in a
    different datatype under the hood. Ive been trying all kinds of tricks
    including translate but it's no good. I wonder if it could be that the
    string gets turned into an array or something down in the cellar... Odd
    thing this...

    "Joe Fawcett" <joefawcett@newsgroup.nospam> wrote in message
    news:%23ThhDUCJHHA.3952@TK2MSFTNGP02.phx.gbl...
    > I'm not sure that's the problem Julian, xsl:with-param's select attribute
    > accepts an XPath expression. The trouble is the expression being passed
    > has an spurious pair of quotes:
    > <xsl:with-param name="targetnodename" select="&quot;Name2&quot;" />
    >
    > I haven't done any custom functoids in BizTalk, perhaps someone on one of
    > the BizTalk groups may be able to help.
    >
    >
    > --
    >
    > Joe Fawcett (MVP - XML)
    >
    > http://joe.fawcett.name
    >
    >
    > "Julian F. Reschke" <julian.reschke@nospam-greenbytes.de> wrote in message
    > news:%23FJP4BCJHHA.1248@TK2MSFTNGP02.phx.gbl...
    >> Nik schrieb:
    >>> Hey boys and girls,
    >>>
    >>>
    >>>
    >>> I ran into a bit of a piccle with the mapper. I''m writing a custom xslt
    >>> fuctoid and taking in an xpath as a parameter.
    >>>
    >>> The problem is that when I connect the functoid with an element in the
    >>> mapper, it generates double quotes around the
    >>> ...

    >>
    >> XSLT is a compiled language. You can't put XPath expressions into strings
    >> and let them be evaluated (in absence of extension functions for that
    >> purpose, but those are not part of the spec).
    >>
    >> Best regards, Julian

    >
    >




  6. Default Re: XSLT xpath call-template problem with double quotes

    Nik wrote:
    > Hi Joe, Yepp that it. Withouth the double quotes it works fine. It seems
    > like the result of passing in the double quoted string seems to result in a
    > different datatype under the hood.


    Not under the hood, for XPath it is a string literal if you put
    something in double or single quotes. So the result is a string value.
    And as Julian has pointed out there is no dynamic evaluation of strings
    as an XPath expression in XSLT. So you need to get rid of the quotes.


    --

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/

  7. Default Re: XSLT xpath call-template problem with double quotes

    A good nights sleep and a session in the debugger was what I needed to see
    your point Julian and Martin. When I use the single quotes the result stored
    in the parameter is a node set. With the double quotes it becomes a string.
    And that's what the value-of cant evaluate as xpath. What I need is an xslt
    funtion of type exec(string).
    I feel pretty dense not realizing this from the start but better later than
    never. Back to the drawing board... Thanks for the pointer boys.

    /Niklas Pettersson

    "Nik" <n1@tecnik.se> wrote in message
    news:uXU52fEJHHA.3936@TK2MSFTNGP02.phx.gbl...
    > Hi Julian,
    > The sample does work without the extra quote. Good ol value-of select
    > works fine on xpath statements stored in variables. The thing is that
    > something seems to happen with the string when it is surrounded by the
    > double quotes. I've been shaking the box all kinds of ways but it seems
    > like the string gets saved in another datatype or something under the
    > hood. It really feels like there is something fishy going on down in the
    > cellar here...
    >
    >
    > "Julian F. Reschke" <julian.reschke@nospam-greenbytes.de> wrote in message
    > news:%23FJP4BCJHHA.1248@TK2MSFTNGP02.phx.gbl...
    >> Nik schrieb:
    >>> Hey boys and girls,
    >>>
    >>>
    >>>
    >>> I ran into a bit of a piccle with the mapper. I''m writing a custom xslt
    >>> fuctoid and taking in an xpath as a parameter.
    >>>
    >>> The problem is that when I connect the functoid with an element in the
    >>> mapper, it generates double quotes around the
    >>> ...

    >>
    >> XSLT is a compiled language. You can't put XPath expressions into strings
    >> and let them be evaluated (in absence of extension functions for that
    >> purpose, but those are not part of the spec).
    >>
    >> Best regards, Julian

    > "Julian F. Reschke" <julian.reschke@nospam-greenbytes.de> wrote in message
    > news:%23FJP4BCJHHA.1248@TK2MSFTNGP02.phx.gbl...
    >> Nik schrieb:
    >>> Hey boys and girls,
    >>>
    >>>
    >>>
    >>> I ran into a bit of a piccle with the mapper. I''m writing a custom xslt
    >>> fuctoid and taking in an xpath as a parameter.
    >>>
    >>> The problem is that when I connect the functoid with an element in the
    >>> mapper, it generates double quotes around the
    >>> ...

    >>
    >> XSLT is a compiled language. You can't put XPath expressions into strings
    >> and let them be evaluated (in absence of extension functions for that
    >> purpose, but those are not part of the spec).
    >>
    >> Best regards, Julian

    >
    >




  8. Default RE: XSLT xpath call-template problem with double quotes


    > Hey boys and girls,
    >
    >
    >
    > I ran into a bit of a piccle with the mapper. I''m writing a custom xslt
    > fuctoid and taking in an xpath as a parameter.
    >
    > The problem is that when I connect the functoid with an element in the
    > mapper, it generates double quotes around the
    >
    > parameters. Then, when I run a value-of statement on the xpath parameter I
    > get the xpath statement, not the value of the evaluation! The problem turns
    > out to be the double quotes. I created an exampel that runs in xmlspy and it
    > works the same way. It works with single quotes but not with double. I can't
    > do anything about the call unfortunately, what I can effect is the
    > XpathLookupFunctoid template below.
    >
    > What I need is a way to convince the value-of statement to evalutate the
    > statement instead of just outputting the xpath statemenat by itself.
    >
    > I tryed all kinds of tricks that I could emagine including substrings and
    > variables. It seems that the string becomes a totally different animal once
    > it gets double quoted.
    >
    > Below is the xmlspy sample you can run in xmlspy. If the extra quote sight
    > on the xpath parameter in the call-template statement is removed it works
    > fine. But since that's generated by Biztalk I cant do anything about it so
    > the
    > manipulation needs to be done in XpathLookupFunctoid:
    >
    > Below is the xmlspy compatible example:
    >
    > <?xml version="1.0" encoding="UTF-8"?>
    > <xsl:stylesheet version="1.0"
    > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    >
    >
    >
    >
    > <xsl:template match="/">
    > <xsl:call-template name="XpathLookupFunctoid">
    > <xsl:with-param name="searchparam" select="9" />
    > <xsl:with-param name="targetnodename"
    > select="&quot;Name2&quot;" />
    > <xsl:with-param name="xpath"
    > select="&quot;(//*[local-name()='dtParParty' and
    > PartyTypeCode=9]/Shortname)[1]&quot;" />
    > <xsl:with-param name="defaultvalue" select="&quot;NPs
    > Default value&quot;" />
    > </xsl:call-template>
    >
    > </xsl:template>
    >
    > <xsl:template name="XpathLookupFunctoid">
    > <xslaram name="searchparam" />
    > <xslaram name="targetnodename" />
    > <xslaram name="xpath" />
    > <xslaram name="defaultvalue" />
    >
    > <xsl:variable name="ren" select="$xpath"/>
    >
    > <xsl:element name="{$targetnodename}">
    > Resultat: <xsl:value-of select="$ren"/>
    > </xsl:element>
    > </xsl:template>
    >
    > </xsl:stylesheet>
    >
    >
    >
    > Greatfull for all ideas
    >
    >
    > Niklas Pettersson
    > Karlstad, Sweden
    >
    >
    >
    >
    >
    >


    Nice site you have! http://www.abkorto.org/dizionario

    BizTalk Utilities - Frustration free BizTalk Adapters
    http://www.topxml.com/biztalkutilities

  9. Default RE: XSLT xpath call-template problem with double quotes


    > Hey boys and girls,
    >
    >
    >
    > I ran into a bit of a piccle with the mapper. I''m writing a custom xslt
    > fuctoid and taking in an xpath as a parameter.
    >
    > The problem is that when I connect the functoid with an element in the
    > mapper, it generates double quotes around the
    >
    > parameters. Then, when I run a value-of statement on the xpath parameter I
    > get the xpath statement, not the value of the evaluation! The problem turns
    > out to be the double quotes. I created an exampel that runs in xmlspy and it
    > works the same way. It works with single quotes but not with double. I can't
    > do anything about the call unfortunately, what I can effect is the
    > XpathLookupFunctoid template below.
    >
    > What I need is a way to convince the value-of statement to evalutate the
    > statement instead of just outputting the xpath statemenat by itself.
    >
    > I tryed all kinds of tricks that I could emagine including substrings and
    > variables. It seems that the string becomes a totally different animal once
    > it gets double quoted.
    >
    > Below is the xmlspy sample you can run in xmlspy. If the extra quote sight
    > on the xpath parameter in the call-template statement is removed it works
    > fine. But since that's generated by Biztalk I cant do anything about it so
    > the
    > manipulation needs to be done in XpathLookupFunctoid:
    >
    > Below is the xmlspy compatible example:
    >
    > <?xml version="1.0" encoding="UTF-8"?>
    > <xsl:stylesheet version="1.0"
    > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    >
    >
    >
    >
    > <xsl:template match="/">
    > <xsl:call-template name="XpathLookupFunctoid">
    > <xsl:with-param name="searchparam" select="9" />
    > <xsl:with-param name="targetnodename"
    > select="&quot;Name2&quot;" />
    > <xsl:with-param name="xpath"
    > select="&quot;(//*[local-name()='dtParParty' and
    > PartyTypeCode=9]/Shortname)[1]&quot;" />
    > <xsl:with-param name="defaultvalue" select="&quot;NPs
    > Default value&quot;" />
    > </xsl:call-template>
    >
    > </xsl:template>
    >
    > <xsl:template name="XpathLookupFunctoid">
    > <xslaram name="searchparam" />
    > <xslaram name="targetnodename" />
    > <xslaram name="xpath" />
    > <xslaram name="defaultvalue" />
    >
    > <xsl:variable name="ren" select="$xpath"/>
    >
    > <xsl:element name="{$targetnodename}">
    > Resultat: <xsl:value-of select="$ren"/>
    > </xsl:element>
    > </xsl:template>
    >
    > </xsl:stylesheet>
    >
    >
    >
    > Greatfull for all ideas
    >
    >
    > Niklas Pettersson
    > Karlstad, Sweden
    >
    >
    >
    >
    >
    >


    Lavoro eccellente! ..ringraziamenti per le informazioni..realmente lo apprezzo: D http://www.bovso.org/bambini

    BizTalk Utilities - Frustration free BizTalk Adapters
    http://www.topxml.com/biztalkutilities

  10. Default RE: XSLT xpath call-template problem with double quotes


    > Hey boys and girls,
    >
    >
    >
    > I ran into a bit of a piccle with the mapper. I''m writing a custom xslt
    > fuctoid and taking in an xpath as a parameter.
    >
    > The problem is that when I connect the functoid with an element in the
    > mapper, it generates double quotes around the
    >
    > parameters. Then, when I run a value-of statement on the xpath parameter I
    > get the xpath statement, not the value of the evaluation! The problem turns
    > out to be the double quotes. I created an exampel that runs in xmlspy and it
    > works the same way. It works with single quotes but not with double. I can't
    > do anything about the call unfortunately, what I can effect is the
    > XpathLookupFunctoid template below.
    >
    > What I need is a way to convince the value-of statement to evalutate the
    > statement instead of just outputting the xpath statemenat by itself.
    >
    > I tryed all kinds of tricks that I could emagine including substrings and
    > variables. It seems that the string becomes a totally different animal once
    > it gets double quoted.
    >
    > Below is the xmlspy sample you can run in xmlspy. If the extra quote sight
    > on the xpath parameter in the call-template statement is removed it works
    > fine. But since that's generated by Biztalk I cant do anything about it so
    > the
    > manipulation needs to be done in XpathLookupFunctoid:
    >
    > Below is the xmlspy compatible example:
    >
    > <?xml version="1.0" encoding="UTF-8"?>
    > <xsl:stylesheet version="1.0"
    > xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    >
    >
    >
    >
    > <xsl:template match="/">
    > <xsl:call-template name="XpathLookupFunctoid">
    > <xsl:with-param name="searchparam" select="9" />
    > <xsl:with-param name="targetnodename"
    > select="&quot;Name2&quot;" />
    > <xsl:with-param name="xpath"
    > select="&quot;(//*[local-name()='dtParParty' and
    > PartyTypeCode=9]/Shortname)[1]&quot;" />
    > <xsl:with-param name="defaultvalue" select="&quot;NPs
    > Default value&quot;" />
    > </xsl:call-template>
    >
    > </xsl:template>
    >
    > <xsl:template name="XpathLookupFunctoid">
    > <xslaram name="searchparam" />
    > <xslaram name="targetnodename" />
    > <xslaram name="xpath" />
    > <xslaram name="defaultvalue" />
    >
    > <xsl:variable name="ren" select="$xpath"/>
    >
    > <xsl:element name="{$targetnodename}">
    > Resultat: <xsl:value-of select="$ren"/>
    > </xsl:element>
    > </xsl:template>
    >
    > </xsl:stylesheet>
    >
    >
    >
    > Greatfull for all ideas
    >
    >
    > Niklas Pettersson
    > Karlstad, Sweden
    >
    >
    >
    >
    >
    >


    The information I found here was rather helpful. Thank you for this. http://www.flryanair.org/uomo

    BizTalk Utilities - Frustration free BizTalk Adapters
    http://www.topxml.com/biztalkutilities

+ Reply to Thread
Page 1 of 9 1 2 3 ... LastLast

Similar Threads

  1. Problem dealing with double quotes in InnerHTML
    By Application Development in forum Javascript
    Replies: 24
    Last Post: 12-15-2007, 03:05 PM
  2. Problem dealing with double quotes in InnerHTML
    By Application Development in forum DOTNET
    Replies: 1
    Last Post: 12-11-2007, 06:12 AM
  3. Problem dealing with double quotes in InnerHTML
    By Application Development in forum Javascript
    Replies: 0
    Last Post: 12-11-2007, 05:37 AM
  4. single quotes, double quotes and "undefined index"
    By Application Development in forum PHP
    Replies: 15
    Last Post: 07-17-2007, 08:07 AM
  5. Urgent: help needed : "Problem with double quotes"
    By Application Development in forum Perl
    Replies: 2
    Last Post: 02-10-2004, 01:11 PM