plonediazoxdv

How to copy element's children to an other element's specific attribute with Diazo


How to fill properly a specific tag attribute taking the content from the original page by using Diazo in the following case?

A skeleton for new site has several meta tags like this:

<meta name="Author" content="author" />

XPATH for the author in Plone default welcome page:

//span[@class='documentAuthor']/a

XPATH for the Author meta tag in the new theme skeleton:

/html/head/meta[@name='Author']

So I would like to fill the content="author" to be like content="Admin" from the original page.


Solution

  • The best solution I have found so far is:

    <replace theme="/html/head/meta[@name='Author']">
     <xsl:variable name="auth" select="//span[@class='documentAuthor']/a" />
     <meta name="Author" content="{$auth}" />
    </replace>