[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] Applying templates based upon param passed in and tokenized
Subject: [xsl] Applying templates based upon param passed in and tokenized From: "Calvados Boulard" <calvados.boulard@xxxxxxxxx> Date: Thu, 1 May 2008 09:43:13 -0700 |
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.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Problem with Safari?, Manfred Staudinger | Thread | Re: [xsl] Applying templates based , David Carlisle |
Re: [xsl] Problem with Safari?, Manfred Staudinger | Date | [xsl] function-available returns fa, Manfred Staudinger |
Month |
Keywords