I have the following slightly odd content: <artwork> contains ASCII
art, to be inserted in the output document.  It has an optional
attribute, src=, which is to be copied to an output HTML document
instead of the ASCII art.

When I'm editing, I want to display both, even though when you're
rendering you only see one or the other.  I'm using the following css:

artwork::attribute() {
        attribute-content-left: "[" attribute-label() ":";
        attribute-content-middle: value-editor(attribute, attribute());
        attribute-content-right: "] ";
        color: purple;
        show-attribute: when-added;
}
artwork::attribute(src) {
        display: block;
        attribute-content-left: "";
        attribute-content-middle: division(content(paragraph("This image will
be used in HTML/PDF output instead of the ASCII one."),
                                image-viewport(attribute, src,
                                        data-type, anyURI,
                                        viewport-width, 98%,
                                        content-width,
                                               xpath("if(@width, @width, 
'scale-to-fit')"),
                                        content-height,
                                               xpath("if(@height, @height, 
'scale-to-fit')"),
                                        preserve-aspect-ratio, yes),
                                paragraph("")));
        attribute-content-right: "";
}
figure artwork:before {
        display: block;
        content: attributes();
        white-space: normal;
        font-family: sans-serif;
        background-color: white;
}
figure artwork {
        display: block;
        white-space: pre;
        font-family: monospace;
        background-color: #ffffcc;
        /* can we display a vertical line at 70 characters? */
}

This works great, except that the image-viewport is limited to
somewhere around 210 pixels, so if the width attribute is specified
and is larger than that, the image gets truncated.  Is there any way
around this?  I've tried "width: 100%" in the artwork::attribute(src),
and obviously you can see the viewport-width that's still in there.

Thanks for any suggestions,
  Bill

Reply via email to