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. |