[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Applying templates based upon param passed in and tok
Hi there...I'm trying to apply templates based upon a param that I've passed in, tokenised and split via substring... <xsl:param name="siteIDString" select="'11111111~00000008,11111111~00000002,11111111~00000005,11111111~11111114,11111111~14564444,11111111~14564442,11111111~00000004,1~1,1~22,'"/> <xsl:template match="/"> <xsl:apply-templates select="aspect"/> </xsl:template> <xsl:template match="aspect"> <favorite> <xsl:for-each select="tokenize($siteIDString, ',')"> <xsl:variable name="sID"><xsl:value-of select="substring-before(.,'~')"/></xsl:variable> <xsl:variable name="dID"><xsl:value-of select="substring-after(.,'~')"/></xsl:variable> <xsl:apply-templates select="site[@id='$sID']" mode="goodSite"/> <xsl:apply-templates select="document[@id='$dID']" mode="goodDoc"/> </xsl:for-each> </favorite> </xsl:template> <xsl:template match="site" mode="goodSite"> <xsl:copy> <xsl:copy-of select="@*"/> </xsl:copy> </xsl:template> <xsl:template match="document" mode="goodDoc"> <xsl:copy> <xsl:copy-of select="@*"/> </xsl:copy> </xsl:template> But I keep getting an error "Axis step child::element(site,xs:anyType) cannot be used here: the context item is an atomic value; My source xml looks as follows: <root> <site id='11111111' otherAttributes='otherValues'> <dir id='00000001' otherAttributes='otherValues'> <document id='00000008' otherAttributes='otherValues'/> </dir> </site> <site id='11111112' otherAttributes='otherValues'> <dir id='00000002' otherAttributes='otherValues'> <document id='00000028' otherAttributes='otherValues'/> </dir> </site> </root> Basically i'm trying to strip out all <dir> and <document> nodes that do not have an site-document id found in the passed in param. Any help with this would be greatly appreciated. Thanks...Cal.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|