This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Evaluating an expression as an XPath expression


A familiar problem: 

What's the difference between:

		<xsl:variable name="oexpr">//PO</xsl:variable>
		<xsl:if test="saxon:eval(saxon:expression($oexpr))">
			<p>Found it: <xsl:value-of select="$oexpr"/></p>
		</xsl:if>

and 

		<xsl:for-each select="document(VC.xml')//Expr">
			<xsl:variable name="expr"><xsl:value-of
select="."/></xsl:variable> 
			<xsl:if test="saxon:eval(saxon:expression($expr))">
				<p>Found it: <xsl:value-of
select="$expr"/></p>
			</xsl:if>
		</xsl:for-each>

where VC.xml contains 

	<Exprs>
	<Expr>//PO</Expr>
	</Exprs>

?

I can't seem to make the two tests come out the same (both positive when the
XML file being processed has a PO element and both negative when it
doesn't). The first seems to work; the second (with document()) fails.

As usual, I suspect that I'm hitting the familiar node-set versus
tree-fragment versus string-value-of-text-node thing.

So my question is, what kind of thing is in $oexpr and which is in $expr?

Thanks

Mark


----------------------------------------------------------------------------
----
 
Mark Feblowitz                                   [t] 617.715.7231
Frictionless Commerce Incorporated     [f] 617.495.0188 
XML Architect                                     [e]
mfeblowitz@frictionless.com
400 Technology Square, 9th Floor 
Cambridge, MA 02139 
www.frictionless.com  
 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]