Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Generating a nodeset via code.

From: "Joe Fawcett" <joefawcett@----------.------>
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 




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent