.xslt script for creating Redirect Pages


(Gjboyd7) #1

Hi

 

We are trying to configure an .xslt which will be used by a Matrix Feed XML asset.  this will be used to create Redirect Pages within matrix.

 

What is the value required for setting the redirect Page, URL.

 

here is what we have currently in .xslt (see below), and we are using <assetattribute name="page_redirect"><xsl:value-of select="redirect_to" /></assetattribute>

 

which is not working.

 

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 
  <xsl:template match="/friendlyurls">
  <squizfeed>
    <xsl:apply-templates select="friendly_url"/>
  </squizfeed>
  </xsl:template>
 
  <xsl:template match="friendly_url">
    <feeddata action="takeover">
      <newhomes>
        <newhome>
          <searchhomes>
            <searchhome assetid="default" autocreate="true"></searchhome>
          </searchhomes>
        </newhome>
      </newhomes>
      <assetset>
        <asset assettype="Redirect Page" linktype="type-2" status="live">
          <assetattribute name="assetid" primarykey="true"><xsl:value-of select="id" /></assetattribute>
          <assetattribute name="name"><xsl:value-of select="slug" /></assetattribute>
          <assetattribute name="short_name"><xsl:value-of select="slug" /></assetattribute>
          <assetattribute name="page_redirect"><xsl:value-of select="redirect_to" /></assetattribute>
          <function name="set_web_path" event="after_update"><xsl:value-of select="slug" /></function>
        </asset>
      </assetset>
    </feeddata>
  </xsl:template>
 
</xsl:stylesheet>
 
thanks

(Gjboyd7) #2

I answered my own question...

 

We ended up using <assetattribute name="redirect_url"><xsl:value-of select="redirect_to" /></assetattribute>

 

And got all the asset names from sq_ast_attr table.