| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| 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=""Name2"" /> <xsl:with-param name="xpath" select=""(//*[local-name()='dtParParty' and PartyTypeCode=9]/Shortname)[1]"" /> <xsl:with-param name="defaultvalue" select=""NPs Default value"" /> </xsl:call-template> </xsl:template> <xsl:template name="XpathLookupFunctoid"> <xsl aram name="searchparam" /><xsl aram name="targetnodename" /><xsl aram name="xpath" /><xsl aram 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
| |||
| |||
| 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
| |||
| |||
| 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=""Name2"" /> 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
| |||
| |||
| 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
| |||
| |||
| 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=""Name2"" /> > > 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
| |||
| |||
| 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
| |||
| |||
| 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
| |||
| |||
| > 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=""Name2"" /> > <xsl:with-param name="xpath" > select=""(//*[local-name()='dtParParty' and > PartyTypeCode=9]/Shortname)[1]"" /> > <xsl:with-param name="defaultvalue" select=""NPs > Default value"" /> > </xsl:call-template> > > </xsl:template> > > <xsl:template name="XpathLookupFunctoid"> > <xsl aram name="searchparam" />> <xsl aram name="targetnodename" />> <xsl aram name="xpath" />> <xsl aram 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
| |||
| |||
| > 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=""Name2"" /> > <xsl:with-param name="xpath" > select=""(//*[local-name()='dtParParty' and > PartyTypeCode=9]/Shortname)[1]"" /> > <xsl:with-param name="defaultvalue" select=""NPs > Default value"" /> > </xsl:call-template> > > </xsl:template> > > <xsl:template name="XpathLookupFunctoid"> > <xsl aram name="searchparam" />> <xsl aram name="targetnodename" />> <xsl aram name="xpath" />> <xsl aram 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
| |||
| |||
| > 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=""Name2"" /> > <xsl:with-param name="xpath" > select=""(//*[local-name()='dtParParty' and > PartyTypeCode=9]/Shortname)[1]"" /> > <xsl:with-param name="defaultvalue" select=""NPs > Default value"" /> > </xsl:call-template> > > </xsl:template> > > <xsl:template name="XpathLookupFunctoid"> > <xsl aram name="searchparam" />> <xsl aram name="targetnodename" />> <xsl aram name="xpath" />> <xsl aram 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 |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.