XSLT xpath call-template problem with double quotes

This is a discussion on XSLT xpath call-template problem with double quotes within the Framework and Interface Programming forums in category; 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 ...

Go Back   Application Development Forum > Framework and Interface Programming

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 12-20-2006, 04:55 AM
Nik
Guest
 
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







Reply With Quote
  #2  
Old 12-20-2006, 05:20 AM
Julian F. Reschke
Guest
 
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
Reply With Quote
  #3  
Old 12-20-2006, 05:53 AM
Joe Fawcett
Guest
 
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



Reply With Quote
  #4  
Old 12-20-2006, 10:03 AM
Nik
Guest
 
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



Reply With Quote
  #5  
Old 12-20-2006, 10:06 AM
Nik
Guest
 
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

>
>



Reply With Quote
  #6  
Old 12-20-2006, 10:25 AM
Martin Honnen
Guest
 
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/
Reply With Quote
  #7  
Old 12-21-2006, 03:01 AM
Nik
Guest
 
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

>
>



Reply With Quote
  #8  
Old 02-22-2007, 12:53 PM
Nice site you have! http://www.abkorto.org/dizionario
Guest
 
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
Reply With Quote
  #9  
Old 02-24-2007, 10:46 AM
Lavoro eccellente! ..ringraziamenti per le informazioni..realmente lo apprezzo: D http://www.bovso.o
Guest
 
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
Reply With Quote
  #10  
Old 02-26-2007, 04:55 AM
The information I found here was rather helpful. Thank you for this. http://www.flryanair.org/uomo
Guest
 
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 With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 03:19 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.