NOTATION

1. Notation
2. notation and unparsed-entity-uri

1.

Notation

David Carlisle


I have an entity named "logo" which refers to a gif file. 

I am trying to write <img src=".... and then chuck my attribute value in
	

If you mean that your source looks like this, with the entity declared in the DTD and the attribute on your source element declared to be of type ENTITY :

<!NOTATION GIF		SYSTEM "GIF">
<!ENTITY mypic SYSTEM "a/b/c.gif" NDATA GIF>

<!ATTLIST xxx src ENTITY #IMPLIED>

...

<xxx src="mypic"/>

then you can reference the entity value as follows:

<xsl:template match="xxx">
 <img src="{unparsed-entity-uri(@src)}"/>
</xsl:template>

which would produce the output

<img src="a/b/c.gif"/>

2.

notation and unparsed-entity-uri

Jeni Tennison

why the following code(this is only an excerpt from the relevant XML file) will not import my JPEG? Is there an XSLT alternative to importing the file?

<?xml version="1.0" standalone="no"?>
<?xml-stylesheet type="text-xsl" href="F1_2_BROWSER.xsl"?>
<!DOCTYPE MESSAGE [
<!ELEMENT MESSAGE (IMAGE,REF*,MIT*,MSG*)>
<!ENTITY LOGO SYSTEM "team.jpg" NDATA JPEG>
<!NOTATION JPEG SYSTEM "team.jpg">	
<!ELEMENT IMAGE EMPTY>
<!ATTLIST IMAGE SOURCE ENTITY #REQUIRED>
<!ELEMENT REF ( #PCDATA)>
<!ELEMENT MIT ( #PCDATA)>
<!ELEMENT MSG ( #PCDATA)>
]>
<MESSAGE>
	<IMAGE SOURCE="LOGO"/>
	<REF>11 235656</REF>
	<REF>IT 12345678</REF>
	<MIT>499235400490724</MIT>

</MESSAGE>

What are you expecting it to do? In your DTD you say that the entity LOGO is a JPEG external unparsed entity to be found at 'team.jpg'. In the XML you reference that entity, but an XML parser won't do anything with that in particular, it's just a reference to that image.

If you want to, for example, create some HTML with an img element that references that same image, then you need the unparsed-entity-uri() function, which takes a (string) entity name and gives you the URL for it, so in your case:

  unparsed-entity-uri('LOGO')

will give you the URL

  .../team.jpg

It gives you the absolute URL for the entity.

So you could do:

<xsl:template match="IMAGE">
   <img src="{unparsed-entity-uri(@SOURCE)}" />
</xsl:template>

to get the XSLT to generate an HTML img element for the relevant image.