eZ Community » Forums » Developer » Change style of elements of embed...
expandshrink

Change style of elements of embed block using XSL

Change style of elements of embed block using XSL

Friday 05 February 2016 12:00:09 pm

Hi,

I am using Symfony based ezpublish5.4. On front, on my item detail view page I am using a XSL stylesheet to change the look for some block from my content of "Rich Text Editor"

Ref:

https://doc.ez.no/display/EZP/How+to+implement+a+Custom+Tag+for+XMLText+FieldType

On my content, I have added one image(embed with caption and alternative text) from admin end:
 paragraph » embed
That is showing the following block on "front end" on detail view page:
<div>
    <a href="http://example.com" rel="lightbox" title="Caption added from admin end">
        <img src="test_source" width="400" height="225" alt="alt text" title="title">
    </a>
</div>

 

On my "YML" I have the following settings:
system:
    default:
        fieldtypes:
            ezxml:
                custom_tags:
                    - { path: %kernel.root_dir%/../src/MyBundle/Resources/override_xsl/item_full.xsl, priority: 10 }

 

From the "XSL" file overwrite_full.xsl, I am able to generate the same block using the following code:
<xsl:template match="embed">
    <div>
       <xsl:value-of select="text()" disable-output-escaping="yes"/>
    </div>
</xsl:template>

I want to add one extra div with the "caption" from the "title" attribute of anchor "a"

how can I get the following result:

<div>
    <a href="http://example.com" rel="lightbox" title="Caption added from admin end">
        <img src="test_source" width="400" height="225" alt="alt text" title="title">
    </a>

    <div>Caption added from admin end</div>
</div>

by changing the "XSL" file?

Modified on Friday 05 February 2016 12:02:08 pm by Jyotirmoy Biswas

No reply yet!

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from