cancel
Showing results for 
Search instead for 
Did you mean: 

How to add meta data(Keywords)

amitbhardwaj
Champ in-the-making
Champ in-the-making
Hi friends
I have used xsd and xsl to create a webform. I have captured data using the web form, which gave me an HTML and an xml output.
My problem is that i have to add some keywords to those html pages (these keywords are given by user only at the time of html page creation)
These keywords helps in search for those web pages.

My XSD file is
============
<?xml version="1.0"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:nf="http://www.alfresco.org/alfresco/nf"
   targetNamespace="http://www.alfresco.org/alfresco/nf"
   elementFormDefault="qualified">

   <!– defines the form for creating a navigation hierarchy –>
   <xs:element name="Template1">
      <xs:complexType>
         <xs:sequence>
            <xs:element name="Imp_Keywords" type="xs:normalizedString" />
            <xs:element name="Description" type="xs:string"/>
         </xs:sequence>
      </xs:complexType>
   </xs:element>
</xs:schema>



My XSL File
============
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xhtml="http://www.w3.org/1999/xhtml"
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:nf="http://www.alfresco.org/alfresco/nf"
   xmlns:fn="http://www.w3.org/2005/02/xpath-functions" exclude-result-prefixes="xhtml">
   <xslSmiley Surprisedutput method="html" encoding="UTF-8" indent="yes"
      doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
      doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'/>

   <xslSmiley Tonguereserve-space elements="*"/>

   <xsl:template match="/">
      <HEAD>
            <META NAME="KEYWORDS" CONTENT="/nf:Template1/nf:Imp_Keywords"/>
      </HEAD>
      <BODY>
      <table>
           <tr>
         <td colspan="2">
            <xsl:value-of select="/nf:Template1/nfSmiley Very Happyescription" disable-output-escaping="yes"/>
            
         </td>
          </tr>
      </table>
    </BODY>
   </xsl:template>
</xsl:stylesheet>



but this code does not work in case of keywords
Please help me
Thanks in advance
Amit
2 REPLIES 2

vijay_alfresco
Champ in-the-making
Champ in-the-making
I would suggest you to use freemarker template instead of xsl. Its very simple as follows,

<#ftl ns_prefixes={"D", "http://www.alfresco.org/alfresco/nf"}>
<HEAD>
   <META NAME="KEYWORDS" CONTENT="${Template1.Imp_Keywords}"/>
</HEAD>
<BODY>
   <table>
      <tr>
         <td colspan="2">

         ${Template1.Description}

         </td>
      </tr>
   </table>
</BODY>

and you can use<#noparse> </#noparse> anywhere in your html or jsp code to skip the tags for parsing or jsp code.

Thanks,
Vijay

amitbhardwaj
Champ in-the-making
Champ in-the-making
thanks vijay its done thanks to u very much Smiley Very Happy