Subject: Re: Intra-document transclusion in IE5 From: Rick Geimer <rick.geimer@xxxxxxx> Date: Sun, 14 Mar 1999 13:44:04 -0800 |
Thanks, the id() thing did the trick, with some minor adjustments. For the sake of posterity, here is the final stylesheet I used in IE5. <xsl:template xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <html> <title>Tales from the bar side</title> <body> <xsl:apply-templates select="drink.doc/*"/> </body> </html> <xsl:define-template-set> <xsl:template match = "drink.doc"> <xsl:apply-templates/> </xsl:template> <xsl:template match = "beverage"> <xsl:value-of/> </xsl:template> <xsl:template match = "drink.body"> <xsl:apply-templates/> </xsl:template> <xsl:template match = "bar.quote"> <p> <xsl:apply-templates select="node()"> <xsl:template match="textnode()"><xsl:value-of/></xsl:template> </xsl:apply-templates> </p> </xsl:template> <xsl:template match = "drink.link"> <xsl:apply-templates select="id(@bev.ref)" /> </xsl:template> </xsl:define-template-set> </xsl:template> Rick Geimer National Semiconductor rick.geimer@xxxxxxx "Blanchette, Larry" wrote: > I came up with this. Use the id() method to select matching elements. > There seems to sketchy support for id in current xsl implementations. XSL:P > does handle it fine, i don't know about ie5. May someone can comment on the > lack of mention of atrribute to attribute compares in the WD (see commented > out code in my example. > > <?xml version="1.0"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> > > <xsl:id element="beverage" attribute="bev.id"/> > > <xsl:template match = "drink.doc"> > <html> > <title>Tales from the bar side</title> > <body> > <xsl:apply-templates select="drink.body"/> > </body> > </html> > </xsl:template> > > <xsl:template match = "bar.quote"> > <p> > <xsl:apply-templates/> > </p> > </xsl:template> > > <xsl:template match = "drink.link"> > > <xsl:text> </xsl:text> > <xsl:apply-templates select="id(@bev.ref)" /> > > <!-- I don't know why the spec ommited this contruct. This might be useful > if the id > isn't unique and there are multiple matches (like drinks with > whiskey). This syntax > is probably off but you get the idea. > > <xsl:apply-templates select="[@bev.refs = > /drink.doc/beverage.list/beverage@xxxxxx]" /> > --> > > <xsl:text> </xsl:text> > > </xsl:template> > > </xsl:stylesheet> > > -----Original Message----- > From: Rick Geimer [mailto:rick.geimer@xxxxxxx] > Sent: Sunday, March 14, 1999 9:15 AM > To: XSL-List@xxxxxxxxxxxxxxxx > Subject: Intra-document transclusion in IE5 > > Hello all, > > This is my first posting to this list. I've been using XSL for about two > weeks now, > and have run into a stumbling block with IE5's implementation. I'm > trying to perform > a "transclusion" (also called source and reflection for those who speak > Pinnacles), > where I take the contents of one element and and display it in the > location of another > element that references it. I've thought of several ways to do this with > the full XSL > spec, but IE5 barfs on all my ideas. Basically, I would like to take > something like > the following instance: > > <?xml version="1.0"?> > <?xml-stylesheet href="drinkdoc.xsl" type="text/xsl"?> > <!DOCTYPE drink.doc [ > <!ELEMENT drink.doc ( beverage.list, drink.body )> > <!ELEMENT beverage.list ( beverage+ ) > > <!ELEMENT beverage ( #PCDATA ) > > <!ATTLIST beverage bev.id ID #REQUIRED> > <!ELEMENT drink.body ( bar.quote+ ) > > <!ELEMENT bar.quote ( #PCDATA | drink.link )* > > <!ELEMENT drink.link EMPTY > > <!ATTLIST drink.link bev.ref IDREF #REQUIRED> > ]> > <drink.doc> > <beverage.list> > <beverage bev.id="drink1">beer</beverage> > </beverage.list> > <drink.body> > <bar.quote>I could really use a <drink.link bev.ref="drink1"/> right > now.</bar.quote> > </drink.body> > </drink.doc> > > And transform it into the following HTML for display: > > <html> > <title>Tales from the bar side</title> > <body> > <p>I could really use a beer right now</p> > </body> > </html> > > Here is my straw-man XSL template as it stands: > > <xsl:template xmlns:xsl="http://www.w3.org/TR/WD-xsl" > xmlns:qxsl="quote:http://www.w3.org/TR/WD-xsl"> > <html> > <title>Tales from the bar side</title> > <body> > <xsl:apply-templates select="drink.doc/*"/> > </body> > </html> > <xsl:define-template-set> > <xsl:template match = "drink.doc"> > <xsl:apply-templates/> > </xsl:template> > <xsl:template match = "drink.body"> > <xsl:apply-templates/> > </xsl:template> > <xsl:template match = "bar.quote"> > <p> > <xsl:apply-templates select="node()"> > <xsl:template match="textnode()"><xsl:value-of/></xsl:template> > </xsl:apply-templates> > </p> > </xsl:template> > <xsl:template match = "drink.link"> > <!-- > What the heck do I put here to get the content of the > beverage element whose bev.id attribute is equal to the current > drink.link's bev.ref attribute? > --> > </xsl:template> > </xsl:define-template-set> > </xsl:template> > > I need to find some way to refer to the contents of the beverage element > > whose bev.id attribute matches the bev.ref attribute of the drink.link > element. > > Any ideas how to make this work in IE5? > > Sincerely, > > Rick Geimer > National Semiconductor > rick.geimer@xxxxxxx > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list > > XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: Intra-document transclusion in , Blanchette, Larry | Thread | Problems with LotusXSL., Michel Goossens |
Re: XSL-optimized DTDs (Was: Re: Mi, Marcus Carr | Date | Re: XSL-optimized DTDs (Was: Re: Mi, John E. Simpson |
Month |