Thread: [Xsltforms-support] Output image/svg+xml
Brought to you by:
alain-couthures
From: Grégoire C. <gco...@gm...> - 2011-01-16 13:48:21
|
Hi Alain, I want to call a web-service that returns an SVG image. So I use : <xf:output mediatype="image/svg+xml" ref="concat('/services/charts/' , instance('test')/value)" model="some-model" /> XSLTForms generates something like this : data:image/svg+xml,/services/charts/310 and the browser complains about an empty document where the image should appear : « This page contains the following errors: error on line 1 at column 1: Document is empty Below is a rendering of the page up to the first error. » When I use the same URL directly with a <img> tag, the image is ok (obviously I test with a browser that accepts an SVG image in a <img> tag, e.g. Firefox 4 or Chrome, but not Firefox 3). Is there an issue with the way XSLTForms displays SVG pictures? Or is this a misunderstanding an my side? Thank you for your help! Grégoire |
From: Grégoire C. <gco...@gm...> - 2011-01-16 14:16:04
|
Hi, I think I understand what the "data:" scheme is about (never used it before). I thought the "ref" attribute was used to resolve an URI (just like with <output mediatype="image/jpeg">), but it seems that, in the case of "image/svg+xml", XSLTForms uses this attribute to get an «SVG instance». Am I right? If so, is there a way to display a non-embedded SVG file whose URL is computed by XForms? Thanks! Grégoire Le 16/01/2011 14:48, Grégoire COLBERT a écrit : > Hi Alain, > > I want to call a web-service that returns an SVG image. So I use : > > <xf:output > mediatype="image/svg+xml" > ref="concat('/services/charts/' , instance('test')/value)" > model="some-model" > /> > > XSLTForms generates something like this : > > data:image/svg+xml,/services/charts/310 > > and the browser complains about an empty document where the image should > appear : > > « > This page contains the following errors: > > error on line 1 at column 1: Document is empty > > Below is a rendering of the page up to the first error. > » > > When I use the same URL directly with a <img> tag, the image is ok > (obviously I test with a browser that accepts an SVG image in a <img> > tag, e.g. Firefox 4 or Chrome, but not Firefox 3). > > Is there an issue with the way XSLTForms displays SVG pictures? Or is > this a misunderstanding an my side? > > Thank you for your help! > > Grégoire |
From: COUTHURES A. <ala...@ag...> - 2011-01-19 20:43:02
|
> I think I understand what the "data:" scheme is about (never used it > before). I thought the "ref" attribute was used to resolve an URI (just > like with<output mediatype="image/jpeg">), but it seems that, in the > case of "image/svg+xml", XSLTForms uses this attribute to get an «SVG > instance». Am I right? > > If so, is there a way to display a non-embedded SVG file whose URL is > computed by XForms? According to XForms 1.1 specifications at http://www.w3.org/TR/xforms/#ui-output, this can be forced with a binding to xsd:anyURI. Sorry, this is not yet implemented in XSLTForms... -Alain |
From: Grégoire C. <gco...@gm...> - 2011-01-20 10:08:14
|
Le 19/01/2011 21:43, COUTHURES Alain a écrit : > >> I think I understand what the "data:" scheme is about (never used it >> before). I thought the "ref" attribute was used to resolve an URI (just >> like with<output mediatype="image/jpeg">), but it seems that, in the >> case of "image/svg+xml", XSLTForms uses this attribute to get an «SVG >> instance». Am I right? >> >> If so, is there a way to display a non-embedded SVG file whose URL is >> computed by XForms? > According to XForms 1.1 specifications at > http://www.w3.org/TR/xforms/#ui-output, this can be forced with a > binding to xsd:anyURI. > > Sorry, this is not yet implemented in XSLTForms... > > -Alain > Hi Alain, I'm surprised by your answer, because I use the exact same tags to display JPEG photos and it works. Inside a <repeat>, I use : <xf:output mediatype="image/jpeg" ref="concat('/services/photos/' , id , '/' , photos/photo[1]/id , '/p')" model="modele-annonces"/> The only difference with the SVG mediatype is the way XSLTForms uses the "ref" attribute in "XFOutput.prototype.setValue". In fact the «image/svg+xml» is an exception. Thanks! Grégoire |
From: COUTHURES A. <ala...@ag...> - 2011-01-19 20:14:46
|
> I want to call a web-service that returns an SVG image. So I use : > > <xf:output > mediatype="image/svg+xml" > ref="concat('/services/charts/' , instance('test')/value)" > model="some-model" > /> Apparently, you're trying to create a dynamic XPath expression!!! I'm more and more considering adding an eval() function, specially for debugging but it seems that you should first try with something like this: ref="/services/charts/*[name() = instance('test')/value]" SVG support in XSLTForms is still experimental and you might have to adjust sizes manually. Thank you for your feedbacks! -Alain |