Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Generating a nodeset via code. [Thread Next] Re: Generating a nodeset via code.To: NULL Date: 10/8/2005 11:00:00 AM "Greg Collins [InfoPath MVP]" <Greg.Collins_AT_InfoPathDev.com> wrote in message news:ebLanC4yFHA.664@t...... Ok, maybe this isn't possible, but I'm hoping someone will show me that it is. I've got an ASPX page that takes several parameters. Those are then passed into an XSL as parameters using asp:Xml In the XSL page, I have some C# code which takes the numerous parameters and builds and XPath. I attempt to use that code-built XPath in xsl:variable to select a nodeset. The XPath is good, because if I take the return string and stuff it into the select="" I get the expected results. However, I get: "The expression passed to this method should result in a NodeSet." if I attempt to use the variable set up as: <xsl:variable name="XPATH" select="cs:GenerateXPath($PARAM1, $PARAM2, $PARAM3, $PARAM4)"/> I tried using msxsl:node-set($XPATH)/* on it, but that didn't help. I then get: "Cannot convert the operand to 'Result tree fragment'." If I attempt to use the following, I get no errors, but no selection either: <xsl:variable name="XPATH" select="cs:GenerateXPath($SECTION, $AREA, $GROUP1, $GROUP2)/*"/> Is there any way to do this? Is it even possible? I'm pretty sure I can probably convert this all over to standard XSL, but it will probably be pretty complex--so I'd rather not if I don't have to. Thanx! -- Greg Collins [InfoPath MVP] Please visit: http://www.InfoPathDev.com You cannot evaluate a string an XPath using standard methods. There is often a workaround depending on how complex the XPath is, For example if your string is "myNode" and your $XPATH comes out as "/root/myNode" you can get around this by using: /root/*[name() = 'myNode'] However your path looks more complicated. You could do what you want using C# code but it might turn out to be more trouble than modifying the XSLT. Can you show a bit more of the structure of the source XML and what you are trying to do? -- Joe (MVP - XML) https://mvp.support.microsoft.com/profile=8AA9D5F5-E1C2-44C7-BCE8-8741D22D17A5 | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
