Subject: Re: Referencing an attribute which is an entity From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx> Date: Fri, 17 Nov 2000 16:39:50 +0000 |
Dan, > i have an entity named "logo" which refers to a gif file. it has the > appropriate <!NOTATION> in the corresponding dtd. however, i just can't manage > to output the contents of the entity (via the attribute 'source' from my xml > element). > > i am trying to write <img src=".... and then chuck my attribute value in but > the parser (IE5) just complains. i have tried using " < > etc for > encoding but i still cant get it to work... I *think* that you're after unparsed-entity-uri(). For example, if I have the following XML file: --- test.xml --- <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="test.xsl" ?> <!DOCTYPE image [ <!NOTATION GIF SYSTEM "gif.doc"> <!ENTITY logo SYSTEM 'logo.gif' NDATA GIF> <!ELEMENT image EMPTY> <!ATTLIST image source ENTITY #IMPLIED> ]> <image source="logo" /> --- The 'img' element I want to create has a 'src' equal to the file location of the 'logo' entity. In other words, I want to create something like: <img src="logo.gif" /> Getting the file location of the logo entity involves: unparsed-entity-uri('logo') or, given you want to get this from the 'source' attribute of the image: unparsed-entity-uri(/image/@source) To put that value into the 'src' attribute of an 'img' element, use either xsl:attribute: <img> <xsl:attribute name="src"> <xsl:value-of select="unparsed-entity-uri(/image/@source)" /> </xsl:attribute> </img> or an attribute value template: <img src="{unparsed-entity-uri(/image/@source)}" /> I hope that helps, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Referencing an attribute which , David Carlisle | Thread | XSLT Debugger, Leena Dasgupta |
RE: Referencing an attribute contai, Mangano, Chris | Date | Re: XSLT link to schema, Jeni Tennison |
Month |