The component org.ametys.cms.transformation.xslt.ResolveURIComponent allows you to resolve object urls (files, images, pages, content, etc.) from your XSL.
Add namespace to file headers XSL:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ... xmlns:resolver="org.ametys.cms.transformation.xslt.ResolveURIComponent" ... extension-element-prefixes="... resolver...">
So that you can call any of the methods defined below, using ametys:functionName(argument1, argument2, ...)
Example:
<img src="{resolver:resolveBoundedImage(@type, @uri, 350, 200)}" alt="{@altText}"/>
Description:
Returns theurl of a file, page, content, ...
The method can be called with 2, 3 or 4 arguments.
Arguments:
Name |
Type |
Mandatory |
Description |
---|---|---|---|
type |
String |
yes |
File type.
|
uri |
String |
yes |
URI of the file or object. For a content attribute,uri expects the data path and content identifier (e.g. illustration/image?objectId=content://uuid-uuid-uuid-uuid). |
download |
Boolean |
no |
"true" to obtain a url download |
absolute |
Boolean |
no |
"true" to obtain an absolute url |
Description:
Returns theurl of an image in a given dimension.
The method can be called with 4, 5 or 6 arguments.
Arguments:
Name |
Type |
Mandatory |
Description |
---|---|---|---|
type |
String |
yes |
File type.
|
uri |
String |
yes |
URI of the image For a content attribute,uri expects the data path and content identifier (e.g. illustration/image?objectId=content://uuid-uuid-uuid-uuid). |
height |
int |
yes |
Image height |
width |
int |
yes |
Image width |
download |
Boolean |
no |
"true" to obtain a url download |
absolute |
Boolean |
no |
"true" to obtain an absolute url |
Description:
Returns theurl of an image with an imposed frame (no distortion of the image, no cropping of the image)
The method can be called with 4, 5 or 6 arguments.
Arguments:
Name |
Type |
Mandatory |
Description |
---|---|---|---|
type |
String |
yes |
File type.
|
uri |
String |
yes |
URI of the image For a content attribute,uri expects the data path and content identifier (e.g. illustration/image?objectId=content://uuid-uuid-uuid-uuid). |
maxHeight |
int |
yes |
Maximum image height (frame height) |
maxWidth |
int |
yes |
Maximum image width (frame width) |
download |
Boolean |
no |
"true" to obtain a url download |
absolute |
Boolean |
no |
"true" to obtain an absolute url |
Description:
Returns theurl of an image in an imposed dimension with cropping of the image if necessary (no distortion of the image)
The method can be called with 4, 5 or 6 arguments.
Arguments:
Name |
Type |
Mandatory |
Description |
---|---|---|---|
type |
String |
yes |
File type.
|
uri |
String |
yes |
URI of the image For a content attribute,uri expects the data path and content identifier (e.g. illustration/image?objectId=content://uuid-uuid-uuid-uuid). |
croppedHeight |
int |
yes |
Image height |
croppedWidth |
int |
yes |
Image width |
download |
Boolean |
no |
"true" to obtain a url download |
absolute |
Boolean |
no |
"true" to obtain an absolute url |
Description:
Returns theurl of a base64 image in an imposed dimension (image distortion possible)
The method has 4 arguments
Arguments:
Name |
Type |
Mandatory |
Description |
---|---|---|---|
type |
String |
yes |
File type.
|
uri |
String |
yes |
URI of the image For a content attribute,uri expects the data path and content identifier (e.g. illustration/image?objectId=content://uuid-uuid-uuid-uuid). |
height |
int |
yes |
Image height |
width |
int |
yes |
Image width |
Description:
Returns theurl of a base64 image in an imposed frame (no image distortion, no cropping)
The method has 4 arguments
Arguments:
Name |
Type |
Mandatory |
Description |
---|---|---|---|
type |
String |
yes |
File type.
|
uri |
String |
yes |
URI of the image For a content attribute,uri expects the data path and content identifier (e.g. illustration/image?objectId=content://uuid-uuid-uuid-uuid). |
maxHeight |
int |
yes |
Maximum image height |
maxWidth |
int |
yes |
Maximum image width |
Description:
Returns theurl of a base64 image in an imposed dimension with cropping of the image if necessary (no distortion of the image)
The method has 4 arguments
Arguments:
Name |
Type |
Mandatory |
Description |
---|---|---|---|
type |
String |
yes |
File type.
|
uri |
String |
yes |
URI of the image For a content attribute,uri expects the data path and content identifier (e.g. illustration/image?objectId=content://uuid-uuid-uuid-uuid). |
croppedHeight |
int |
yes |
Image height |
croppedWidth |
int |
yes |
Image width |