cancel
Showing results for 
Search instead for 
Did you mean: 

Adding 180 days to current date in web form

dynamolalit
Champ on-the-rise
Champ on-the-rise
Hi,


I have a web form xsd as shown :



<?xml version="1.0"?>

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

<xs:element name="eJustice">
      <xs:annotation>
         <xs:documentation source="ospi.label">eJustice_2_Title</xs:documentation>
         <xs:documentation source="ospi.description">eJustice_2_Desc</xs:documentation>
      </xs:annotation>
      <xs:complexType>
         <xs:sequence>
         <xs:element name="eJustice_language" type="eJustice_2:LanguageSelect"
                default="English">
               <xs:annotation>
                   <xs:appinfo>
                     <alf:label>${language}</alf:label>
                     <alf:appearance>compact</alf:appearance>
                    </xs:appinfo>
               </xs:annotation>
         </xs:element>         
<xs:element name="Level1" minOccurs="1" fixed="Law" >
   <xs:annotation>
      <xs:documentation source="ospi.label">TextFieldLabel</xs:documentation>
      <xs:documentation source="ospi.description">TextFieldLabelDesc</xs:documentation>
       <xs:appinfo>
      <alf:label>${level1}</alf:label>                     
        </xs:appinfo>
   </xs:annotation>
   <xs:simpleType>
      <xs:restriction base="xs:normalizedString" >
         <xs:maxLength value="20" fixed="true" />
      </xs:restriction>
   </xs:simpleType>
</xs:element>
<xs:element name="Level2" fixed="" nillable="true" minOccurs="0" >
   <xs:annotation>
      <xs:documentation source="ospi.label">TextFieldLabel</xs:documentation>
      <xs:documentation source="ospi.description">TextFieldLabelDesc</xs:documentation>
      <xs:appinfo>
      <alf:label>${level2}</alf:label>                     
        </xs:appinfo>
   </xs:annotation>
   <xs:simpleType>
      <xs:restriction base="xs:normalizedString">
         <xs:maxLength value="20" fixed="true" />
      </xs:restriction>
   </xs:simpleType>
</xs:element>
<xs:element name="Level3" fixed="" nillable="true" minOccurs="0" >
   <xs:annotation>
      <xs:documentation source="ospi.label">TextFieldLabel</xs:documentation>
      <xs:documentation source="ospi.description">TextFieldLabelDesc</xs:documentation>
      <xs:appinfo>
      <alf:label>${level3}</alf:label>                     
        </xs:appinfo>
   </xs:annotation>
   <xs:simpleType>
      <xs:restriction base="xs:normalizedString">
         <xs:maxLength value="20" fixed="true" />
      </xs:restriction>
   </xs:simpleType>
</xs:element>
<xs:element name="Level4" fixed="" nillable="true" minOccurs="0">
   <xs:annotation>
      <xs:documentation source="ospi.label">TextFieldLabel</xs:documentation>
      <xs:documentation source="ospi.description">TextFieldLabelDesc</xs:documentation>
      <xs:appinfo>
      <alf:label>${level4}</alf:label>                     
        </xs:appinfo>
   </xs:annotation>
   <xs:simpleType>
      <xs:restriction base="xs:normalizedString">
         <xs:maxLength value="20" fixed="true" />
      </xs:restriction>
   </xs:simpleType>
</xs:element>
<xs:element name="Taxonomy" minOccurs="1" fixed="2" >
   <xs:annotation>
      <xs:documentation source="ospi.label">TextFieldLabel</xs:documentation>
      <xs:documentation source="ospi.description">TextFieldLabelDesc</xs:documentation>
      <xs:appinfo>
      <alf:label>${taxonomy}</alf:label>                     
        </xs:appinfo>
   </xs:annotation>
   <xs:simpleType>
      <xs:restriction base="xs:normalizedString">
         <xs:maxLength value="20" fixed="true" />
      </xs:restriction>
   </xs:simpleType>
</xs:element>
<xs:element name="Heading" minOccurs="1" default="Law">
   <xs:annotation>
      <xs:documentation source="ospi.label">TextFieldLabel</xs:documentation>
      <xs:documentation source="ospi.description">TextFieldLabelDesc</xs:documentation>
      <xs:appinfo>
      <alf:label>${heading}</alf:label>                     
        </xs:appinfo>
   </xs:annotation>
   <xs:simpleType>
      <xs:restriction base="xs:normalizedString">
         <xs:maxLength value="50" fixed="true" />
      </xs:restriction>
   </xs:simpleType>
</xs:element>

<xs:element name="Introduction" minOccurs="1">
   <xs:annotation>
      <xs:documentation source="ospi.label">TextFieldLabel</xs:documentation>
      <xs:documentation source="ospi.description">TextFieldLabelDesc</xs:documentation>
      <xs:appinfo>
      <alf:label>${introduction}</alf:label>                     
        </xs:appinfo>
   </xs:annotation>
   <xs:simpleType>
      <xs:restriction base="xs:normalizedString">
         <xs:maxLength value="30" fixed="true" />
      </xs:restriction>
   </xs:simpleType>
</xs:element>
<xs:element name="Body_Content" type="xs:string" minOccurs=
                  "1" maxOccurs="1">
            <xs:annotation>
               <xs:appinfo>               
                  <alf:label>${content}</alf:label>   
                  <alf:appearance>custom-styles-mce</alf:appearance>
               </xs:appinfo>
            </xs:annotation>
</xs:element>

<xs:element name="Related_Information" nillable="true" type="eJustice_2:linkInfo" minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
               <xs:appinfo>               
                  <alf:label>${relatedInfo}</alf:label>                  
               </xs:appinfo>
         </xs:annotation>
</xs:element>

<xs:element name="Related_Attachments" nillable="true" type="xs:anyURI" minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
               <xs:appinfo>               
                  <alf:label>${relatedAttachments}</alf:label>                  
               </xs:appinfo>
         </xs:annotation>
</xs:element>

<xs:element name="Keywords" minOccurs="1" >
   <xs:annotation>
      <xs:documentation source="ospi.label">TextFieldLabel</xs:documentation>
      <xs:documentation source="ospi.description">TextFieldLabelDesc</xs:documentation>
      <xs:appinfo>
      <alf:label>${keywords}</alf:label>                     
        </xs:appinfo>
   </xs:annotation>
   <xs:simpleType>
      <xs:restriction base="xs:string">
         <xs:maxLength value="30" fixed="true" />
      </xs:restriction>
   </xs:simpleType>
</xs:element>   


<xs:element name="Content_Updated_Date" type="xs:date"  nillable="true" minOccurs="0">
<xs:annotation>
   <xs:appinfo>               
      <alf:label>${contentUpdatedDate}</alf:label>                  
   </xs:appinfo>
</xs:annotation>
</xs:element>

<xsl:call-template name="date:add">
   <xsl:with-param name="date-time" select="xs:date" />
   <xsl:with-param name="duration" select="P180D" />
</xsl:call-template>

<xs:element name="Content_Date_of_Expiry" type="date:add"  nillable="true" minOccurs="0">
<xs:annotation>
   <xs:appinfo>      
      
      <alf:label>${contentExpiryDate}</alf:label>                  
   </xs:appinfo>
</xs:annotation>
</xs:element>

         </xs:sequence>         
      </xs:complexType>   
   </xs:element>
            
   <xs:complexType name="linkInfo">
      <xs:sequence>
         <xs:element name="Link_Name" type="xs:normalizedString" minOccurs="0" maxOccurs="1" nillable="true" >
         <xs:annotation>
               <xs:appinfo>               
                  <alf:label>${linkName}</alf:label>                  
               </xs:appinfo>
         </xs:annotation>
         </xs:element>
         <xs:element name="Link_URL" type="xs:normalizedString" minOccurs="0" maxOccurs="1" nillable="true" >
         <xs:annotation>
               <xs:appinfo>               
                  <alf:label>${linkUrl}</alf:label>                  
               </xs:appinfo>
         </xs:annotation>
         </xs:element>
         <xs:element name="Link_Description" type="xs:normalizedString" minOccurs="0" maxOccurs="1" nillable="true" >
         <xs:annotation>
               <xs:appinfo>               
                  <alf:label>${LinkDesc}</alf:label>                  
               </xs:appinfo>
         </xs:annotation>
         </xs:element>
         <xs:element name="Owner" type="xs:normalizedString" minOccurs="0" maxOccurs="1" nillable="true" >
         <xs:annotation>
               <xs:appinfo>               
                  <alf:label>${LinkOwner}</alf:label>                  
               </xs:appinfo>
         </xs:annotation>
         </xs:element>
         <xs:element name="Owners_e_Mail_Id" type="xs:normalizedString" minOccurs="0" maxOccurs="1" nillable="true" >
         <xs:annotation>
               <xs:appinfo>               
                  <alf:label>${linkOwnerEmail}</alf:label>                  
               </xs:appinfo>
         </xs:annotation>
         </xs:element>
         
      </xs:sequence>
   </xs:complexType>
   <xs:simpleType name="LanguageSelect">
      <xs:restriction base="xs:normalizedString">
        <xs:enumeration value="български език" id="e"/>
        <xs:enumeration value="ceština"/>
        <xs:enumeration value="Dansk"/>
        <xs:enumeration value="Deutsch"/>
        <xs:enumeration value="Eesti"/>
        <xs:enumeration value="Ελληνικά"/>
        <xs:enumeration value="English"/>
        <xs:enumeration value="Español"/>
        <xs:enumeration value="Français"/>       
        <xs:enumeration value="Gaeilge"/>
        <xs:enumeration value="Italiano"/>
        <xs:enumeration value="latviešu valoda"/>
        <xs:enumeration value="lietuviu kalba"/>
        <xs:enumeration value="Magyar"/>       
        <xs:enumeration value="Malti"/>
        <xs:enumeration value="Nederlands"/>
        <xs:enumeration value="polski"/>
        <xs:enumeration value="Português"/>
        <xs:enumeration value="româna"/>
        <xs:enumeration value="slovencina"/>
        <xs:enumeration value="slovenšcina"/>       
        <xs:enumeration value="suomi;suomen kieli"/>
        <xs:enumeration value="svenska"/>
      </xs:restriction>
   </xs:simpleType>
</xs:schema>

It has two fields : Content_Updated_Date & Content_Date_of_Expiry,both are currently xs:date type.Content_Updated_Date should be today's date which i am getting & Content_Date_of_Expiry should be 180 days after current date .

How can i get this?Has anyone any idea about this?Do i have to use xsl for this?If so how i can get it??
2 REPLIES 2

marutiprasad
Champ in-the-making
Champ in-the-making
Hi,

we can do it in XSL, write a simple macro in xsl. it will change in the rendered XML.


regards,
Maruti.

dynamolalit
Champ on-the-rise
Champ on-the-rise
Hi,

Actually when you use xs:date,dojo date picker will be rendered which is painful to modify.So the date field itself will be populted with the current date using dojo datepicker. :?:

Any idea on how to modify dojo datepicker as per above requirement. :roll:

Anyways ,can you point me to some link or reference for your explanation as it worth a try.  😎