php - In XSLT, can you use XPath on dynamically created elements? -
would expect work or not? (it seems can't use xpath on dynamically created elements, perhaps because they're not in 'behind scenes' magic used make xpath perform well)
<?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:variable name="data"> <fu><bar>test</bar></fu> </xsl:variable> value: <xsl:value-of select="$data/fu/bar" /> </xsl:template> </xsl:stylesheet>
i error in xslt processors i've tried, e.g. "invalid type" when using php5; removing "$" before "data" make error go away, not desired, try match data/fu/bar xml document xslt being ran against.
there aren't easy answers this, "the way" the node-set() function. it's not technically part of xslt 1.0 , therefore isn't supported transformation engines. see link more info: http://www.xml.com/pub/a/2003/07/16/nodeset.html
basically, $data string, not tree, need special function convert tree. why getting "invalid type" - data type mismatch.
Comments
Post a Comment