Problem importing codes template file

Having trouble installing Oxygen? Got a bug to report? Post it all here.
Roadrunnerray
Posts: 7
Joined: Wed May 18, 2005 7:01 pm
Location: Las Cruces, New Mexico, USA

Problem importing codes template file

Post by Roadrunnerray »

I am trying to import the "codes" template file below but get the following error message:

"Not a valid templates file
Please use a file containing exported templates."

Any assistance will be greatly appreciate.
========================================

<?xml version="1.0" encoding="UTF-8"?>
<templates>
<template contentType="text/xsl" name="fmxslt-client-ip">
<description>Inserts the requesting client's ip address. This is equivalent to the [FMP:ClientIP] tag and the replacement for the [FMP:ClientAddress] tag</description>
<content><![CDATA[<xsl:value-of select="$client-ip"/>]]></content>
</template>
<template contentType="text/xsl" name="fmxslt-client-user-name">
<description>Inserts the user name supplied by the client to access the database. This is equivalent to the [FMP:ClientUserNamer] tag</description>
<content><![CDATA[<xsl:value-of select="$client-ip"/>]]></content>
</template>
<template contentType="text/xsl" name="fmxslt-client-user-password">
<description>Inserts the password supplied by the client to access the database. This is equivalent to the [FMP:ClientPassword] tag</description>
<content><![CDATA[<xsl:value-of select="$client-password"/>]]></content>
</template>
<template contentType="text/xsl" name="fmxslt-client-type">
<description>Inserts code to retrieve the User Agent HTTP Header. This is equivalent to the [FMP:ClientType] tag</description>
<content><![CDATA[<xsl:value-of select="fmxslt:get_header('User-Agent')"/>]]></content>
</template>
<template contentType="text/xsl" name="fmxslt-current-action">
<description>Get the current query action. This is equivalent to the [FMP:CurrentAction] tag</description>
<content><![CDATA[<xsl:value-of select="$current-action"/>]]></content>
</template>
<template contentType="text/xsl" name="fmxslt-current-database">
<description>Get the current database name from the query. This is equivalent to the [FMP:CurrentDatabase] tag</description>
<content><![CDATA[<xsl:value-of select="$current-database"/>]]></content>
</template>
<template contentType="text/xsl" name="fmxslt-current-date">
<description>Get the current date. This is equivalent to the [FMP:CurrentDate] tag</description>
<content><![CDATA[<xsl:value-of select="fmxslt:get_date()"/>]]></content>
</template>
<template contentType="text/xsl" name="fmxslt-current-day">
<description>Get the current day. This is equivalent to the [FMP:CurrentDay] tag</description>
<content><![CDATA[<xsl:value-of select="fmxslt:get_day('long')"/>]]></content>
</template>
<template contentType="text/xsl" name="fmxslt-current-stylesheet">
<description>Get the current stylesheet name. This is equivalent to the [FMP:CurrentFormat] tag</description>
<content><![CDATA[<xsl:value-of select="$current-stylesheet"/>]]></content>
</template>
<template contentType="text/xsl" name="fmxslt-current-found-count">
<description>Get the current foundset size. This is equivalent to the [FMP:CurrentFoundCount] tag</description>
<content><![CDATA[<xsl:value-of select="$current-found-count"/>]]></content>
</template>
<template contentType="text/xsl" name="fmxslt-current-layout">
<description>Get the current layout name from the query. This is equivalent to the [FMP:CurrentLayout] tag</description>
<content><![CDATA[<xsl:value-of select="$current-layout"/>]]></content>
</template>
<template contentType="text/xsl" name="fmxslt-current-lop">
<description>Get the logical operator from the query. This is equivalent to the [FMP:CurrentLOP] tag</description>
<content><![CDATA[<xsl:value-of select="$current-lop"/>]]></content>
</template>
<template contentType="text/xsl" name="fmxslt-current-max">
<description>Get the value of the -max parameter from the query. This is equivalent to the [FMP:CurrentMax] tag</description>
<content><![CDATA[<xsl:value-of select="$current-max"/>]]></content>
</template>
<template contentType="text/xsl" name="fmxslt-current-record-count">
<description>Get the current total record count for the table queried. This is equivalent to the [FMP:CurrentRecordCount] tag</description>
<content><![CDATA[<xsl:value-of select="$current-record-count"/>]]></content>
</template>
<template contentType="text/xsl" name="fmxslt-current-skip">
<description>Get the current value of the -skip query parameter. This is equivalent to the [FMP:CurrentSkip] tag</description>
<content><![CDATA[<xsl:value-of select="$current-skip"/>]]></content>
</template>
<template contentType="text/xsl" name="fmxslt-current-time">
<description>Get the current time. This is equivalent to the [FMP:CurrentTime] tag</description>
<content><![CDATA[<xsl:value-of select="fmxslt:get_time('long')"/>]]></content>
</template>
<template contentType="text/xsl" name="fmxslt-current-token">
<description>Get the value of the current -token query parameter. This is equivalent to the [FMP:CurrentToken] tag</description>
<content><![CDATA[<xsl:call-template name="get-token-value"/>]]></content>
</template>
<template contentType="text/xsl" name="fmxslt-current-token-custom">
<description>Get the value for any token. Set the parameter to the name of the token to retrieve. This is equivalent to the [FMP:CurrentToken] tag</description>
<content><![CDATA[<xsl:call-template name="get-token-value"><xsl:with-param name="token-name" select="'token-name-here'"/></xsl:call-template>]]></content>
</template>


<template contentType="text/xsl" name="fmxslt-link-first">
<description>Inserts a link to the first record in the foundset. This is equivalent to the [FMP:LinkFirst] tag</description>
<content><![CDATA[<xsl:call-template name="link-first"><xsl:with-param name="text" select="'First Record'"/></xsl:call-template>]]></content>
</template>
<template contentType="text/xsl" name="fmxslt-link-last">
<description>Inserts a link to the last record in the foundset. This is equivalent to the [FMP:LinkLast] tag</description>
<content><![CDATA[<xsl:call-template name="link-last"><xsl:with-param name="text" select="'Last Record'"/></xsl:call-template>]]></content>
</template>
<template contentType="text/xsl" name="fmxslt-link-next">
<description>Inserts a link to the next record in the foundset. This is equivalent to the [FMP:LinkNext] tag</description>
<content><![CDATA[<xsl:call-template name="link-next"><xsl:with-param name="text" select="'Next Record'"/></xsl:call-template>]]></content>
</template>
<template contentType="text/xsl" name="fmxslt-link-previous">
<description>Inserts a link to the previous record in the foundset. This is equivalent to the [FMP:LinkPrevious] tag</description>
<content><![CDATA[<xsl:call-template name="link-previous"><xsl:with-param name="text" select="'Previous Record'"/></xsl:call-template>]]></content>
</template>
<template contentType="text/xsl" name="fmxslt-link-recordset">
<description>Inserts a set of links for page by page navigation of the recordset</description>
<content><![CDATA[<xsl:call-template name="link-recordset"/>]]></content>
</template>

<template contentType="text/xsl" name="fmxslt-valuelist-popup">
<description>Creates an HTML <select> control using a specified valuelist. Fill in the parameters to generate the pop-up. The field-value and id parameters are optional.</description>
<content><![CDATA[<xsl:call-template name="valuelist-popup">
<xsl:with-param name="use-default" select="true()"></xsl:with-param>
<xsl:with-param name="field">field-name-here</xsl:with-param>
<xsl:with-param name="field-value">field-value-to-select</xsl:with-param>
<xsl:with-param name="id">dom-id</xsl:with-param>
<xsl:with-param name="valuelist">value-list-name</xsl:with-param>
</xsl:call-template>]]></content>
</template>
<template contentType="text/xsl" name="fmxslt-valuelist-radio">
<description>Creates an HTML radio button control set using a specified valuelist. Fill in the parameters to generate the radio buttons. The field-value and id parameters are optional.</description>
<content><![CDATA[<xsl:call-template name="valuelist-radio">
<xsl:with-param name="field">field-name-here</xsl:with-param>
<xsl:with-param name="field-value">field-value-to-select</xsl:with-param>
<xsl:with-param name="id">dom-id</xsl:with-param>
<xsl:with-param name="valuelist">value-list-name</xsl:with-param>
<!--Set to true to insert a line-break between each checkbox-->
<xsl:with-param name="vertical" select="false()"/>
</xsl:call-template>]]></content>
</template>
<template contentType="text/xsl" name="fmxslt-valuelist-checkbox">
<description>Creates an HTML checkbox control set using a specified valuelist. Fill in the parameters to generate the checkboxes. The field-value and id parameters are optional.</description>
<content><![CDATA[<xsl:call-template name="valuelist-checkbox">
<xsl:with-param name="field">field-name-here</xsl:with-param>
<xsl:with-param name="field-value">field-value-to-select</xsl:with-param>
<xsl:with-param name="id">dom-id</xsl:with-param>
<xsl:with-param name="valuelist">value-list-name</xsl:with-param>
<!--Set to true if the checkbox is being used with a -find query-->
<xsl:with-param name="is-find" select="false()"/>
<!--Set to true to insert a line-break between each checkbox-->
<xsl:with-param name="vertical" select="false()"/>
</xsl:call-template>]]></content>
</template>
</templates>

[/code]
Ray
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Post by Radu »

Hi,

Indeed the code templates export file format has changed from 7 to 8 and there seem to be problems importing the old style format.
We will fix them.
I will get back with either a workaround or a stylesheet to transform from old style to new style format.

Thanks,
Regards, Radu
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Post by Radu »

Hi,

Here's a stylesheet that transforms from the old format to the new one:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output indent="yes"/>
<xsl:template match="/templates">
<serialized>
<map>
<entry>
<String xml:space="preserve">code-templates</String>
<codeTemplateItem-array>
<xsl:for-each select="template">
<codeTemplateItem>
<field name="contentType">
<String xml:space="preserve"><xsl:value-of select="@contentType"/></String>
</field>
<field name="unparsedInsertString">
<String xml:space="preserve"><xsl:value-of select="content/text()"/></String>
</field>
<field name="descriptionString">
<String xml:space="preserve"><xsl:value-of select="description/text()"/>
</String>
</field>
<field name="renderString">
<String xml:space="preserve"><xsl:value-of select="@name"/></String>
</field>
</codeTemplateItem>
</xsl:for-each>
</codeTemplateItem-array>
</entry>
</map>
</serialized>
</xsl:template>
</xsl:stylesheet>
Just apply it in Oxygen on the templates file you posted and save the output in a new XML file. Then go to Options->Preferences->Editor/Code Templates, click Import and import the newly created file. Remember to press Ok in the preferences dialog.

We will also fix the problem with importing old format template files in an upcoming maintainance release.

Regards,
Radu
Roadrunnerray
Posts: 7
Joined: Wed May 18, 2005 7:01 pm
Location: Las Cruces, New Mexico, USA

Post by Roadrunnerray »

Radu wrote:Hi,

Here's a stylesheet that transforms from the old format to the new one:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output indent="yes"/>
<xsl:template match="/templates">
<serialized>
<map>
<entry>
<String xml:space="preserve">code-templates</String>
<codeTemplateItem-array>
<xsl:for-each select="template">
<codeTemplateItem>
<field name="contentType">
<String xml:space="preserve"><xsl:value-of select="@contentType"/></String>
</field>
<field name="unparsedInsertString">
<String xml:space="preserve"><xsl:value-of select="content/text()"/></String>
</field>
<field name="descriptionString">
<String xml:space="preserve"><xsl:value-of select="description/text()"/>
</String>
</field>
<field name="renderString">
<String xml:space="preserve"><xsl:value-of select="@name"/></String>
</field>
</codeTemplateItem>
</xsl:for-each>
</codeTemplateItem-array>
</entry>
</map>
</serialized>
</xsl:template>
</xsl:stylesheet>
Just apply it in Oxygen on the templates file you posted and save the output in a new XML file. Then go to Options->Preferences->Editor/Code Templates, click Import and import the newly created file. Remember to press Ok in the preferences dialog.

We will also fix the problem with importing old format template files in an upcoming maintainance release.

Regards,
Radu

Thanks for the great support! I will give this a whirl...............Ray
Ray
Roadrunnerray
Posts: 7
Joined: Wed May 18, 2005 7:01 pm
Location: Las Cruces, New Mexico, USA

Post by Roadrunnerray »

Radu, just wanted to let you know the transformation worked great.............Ray
Ray
Post Reply