How to design all modules with the same format?

Topics: General, XSLT
May 20, 2011 at 2:22 AM

I've developed several widgets that have been developed by myself and  i want all of my modules have the same format.

For example . I have a block of code HTML for all modules.

<div class="widget-container">

    <div class="widget-title"> TITLE OF WIDGET</div>

    <div class="widget-content">
         CONTENT OF WIDGET
 TEXT - IMAGES - VIDEO - FUNCTIONS ... </div> </div>

How to write a XSL function that has 2 parameters.
- The first parameter is title of widget ( String )
- The second parameter is content of widget that allows input by using Visual Editor.

Thanks.

 

Coordinator
May 20, 2011 at 6:34 AM

Hello,

For the second parameter (Content) use parameter type as XhtmlDocument (parameter widget will be VisualHtmlEditor).
Then on the function "Template" tab something like this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:in="http://www.composite.net/ns/transformation/input/1.0"
xmlns:lang="http://www.composite.net/ns/localization/1.0"
xmlns:f="http://www.composite.net/ns/function/1.0"
xmlns="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="xsl in lang f">
  <xsl:template match="/">
    <html>
      <head>
        <!-- markup placed here will be shown in the head section of the rendered page --></head>
      <body>
        <div class="widget-container">
          <div class="widget-title">
            <xsl:value-of select="/in:inputs/in:param[@name='Title']" />
          </div>
          <div class="widget-content">
            <xsl:copy-of select="/in:inputs/in:param[@name='Content']/*" />
          </div>
        </div>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>

May 20, 2011 at 6:58 AM

Hi Inna

That's all i need . I've completed my widget.

Thank you very much.