RE: external-graphic import error

Subject: RE: external-graphic import error
From: "Frank A. Christoph" <christo@xxxxxxxxxxxxxxxxxx>
Date: Wed, 24 Nov 1999 08:57:17 +0900
Norman Walsh wrote:
> / "Darrell W. Royter" <droyter@xxxxxxxxxxxxxxx> was heard to say:
> | Yesterday, Brandon graciously gave me this peice of code to use for
> | importing an external graphic (thank you, Brandon).
> |
> | (element artwork (make external-graphic entity-system-id:
> |     (string-append (attribute-string "FILE") ".jpg")))
> |
> |    This assumes that <artwork> has a "file" attribute containing the
> | name of the image file without the ".jpg" extension.
> |
> | I tried this and got an error stating that the 1st argument for
> primitive
> | "string-append" of wrong type: "#f" not a string.
> Can you show us a small source snippet? Is it possilbe that
> you're using XML (or a case-sensitive SGML DTD) and 'file' is in
> lowercase?  Anyway the #f error you've got is a clear indication
> that (attribute-string "FILE") isn't finding a FILE attribute or
> it doesn't have a value.

An error I make _all_ the time in exactly this case (figures and external
stuff) is where the FILE attribute is actually not attached to ARTWORK, but
to a parent or child node. For example, the source actually looks like this:

    <image file="foo.jpg"/>

In this case you could change the attribute-string part to:

  (attribute-string "FILE" (select-elements (children (current-node))

or use a qualified rule:

  (element (artwork image) ...)

or of course just "(element image ...)" if you want to treat all IMAGE
elements in the same way.


 DSSSList info and archive:

Current Thread