[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: how do indirection in value-of or select?
>i'm willing to change the syntax of the xml if that helps, >but it does seem like xsl should have some way to do this. >macros? constants? producing elements that are then processed >again by the processor? or can xsl just not do a join? I *think* this is similar to what I've wanted to do for a while and have raised on this list before. As far as I can tell, what would solve my problem (and I think yours) is if an EqualityExpr could take not just a Literal but a select pattern. In other words, Say I have a document: <a> <blist> <b n="foo"><bname>Foo</bname></b> <b n="bar"><bname>Bar</bname>/b> </blist> <clist> <c> <cname>c1</cname> <d>foo</d> </c> <c> <cname>c2</cname> <d>bar</d> </c> <c> <cname>c3</cname> <d>foo</d> <d>bar</d> </c> </clist> </a> I would like to be able to say: <xsl:template match="/a/blist/b"> <xsl:apply-templates select="name"/> <xsl:apply-templates select='/a/clist/c[d=@n]'/> </xsl:template> but you can't say d=@n, only d="literal". At present I use: <xsl:template match="/a/blist/b"> <xsl:apply-templates select="name"/> <xsl:choose> <xsl:when test='.[@n="foo"]'> <xsl:apply-templates select='/a/clist/c[d="foo"]'/> </xsl:when> <xsl:when test='.[@n="bar"]'> <xsl:apply-templates select='/a/clist/c[d="bar"]'/> </xsl:when> </xsl:choose> </xsl:template> which involves knowing about "foo" and "bar" in advance. Fortunately, what *is* possible is automatic generation of the above template from the original document. It works but I don't think it should have to be done that way. I *think* a solution to my problem will be a solution to yours and I think the best solution is if XSL is modified so that an EqualityExpr can take not just a Literal but a select pattern. Comments anyone? James XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|