How to pre-populate the value from xslt to Orbeon form

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to pre-populate the value from xslt to Orbeon form

Rajeeva Lochana BR
This post was updated on .
Hi,

I am using New repeatable grid control in Orbeon form. Need to prepopulate the value from my xstl from.

Please share any working example.

Example: for orbeon form code please have a look on the attached file child-repetable-feilds.xhtml

xslt code:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xsl:output method="xml" indent="yes" />
       
    <xsl:variable name="config" select="document('./configuration.xml')"/> 
               
        <xsl:variable name="children-grid">
                <xsl:for-each select="/User/Children">
                        <children-grid>
                                <child-date-of-birth><xsl:value-of select="DateOfBirth"/></child-date-of-birth>
                                <child-us-citizen><xsl:value-of select="USCitizen"/></child-us-citizen>
                                <child-gender/>
                                <child-ssn/>
                                <child-first-name/>
                                <child-mi/>
                                <child-last-name/>
                                <child-suffix/>
                        </children-grid>
                </xsl:for-each>
        </xsl:variable>
                                               
        <xsl:template match="/">
                <section-1>
                    <xsl:copy-of select="$children-grid">
                        </xsl:copy-of>                       
                </section-1>
        </xsl:template>
               
</xsl:stylesheet>


Pre-populated value Configuration Code

<User>
        <Children>
                 <DateOfBirth>969062400000</DateOfBirth>
                 <ApplicantType>SECONDARY</ApplicantType>
                 <FirstName>JACK</FirstName>
                 <MiddleName>R</MiddleName>
                 <LastName>POWERS</LastName>
                 <Suffix>III</Suffix>
                 <Gender>FEMALE</Gender>
                 <RelationToPrimary>CHILD</RelationToPrimary>
                 <SecureIDValue>123-45-6789</SecureIDValue>
                 <SecureIDType>SSN</SecureIDType>
                 <USCitizen>Yes</USCitizen>
        </Children>
        <Children>
                 <DateOfBirth>969062400000</DateOfBirth>
                 <ApplicantType>SECONDARY</ApplicantType>
                 <FirstName>JACK</FirstName>
                 <MiddleName>R</MiddleName>
                 <LastName>POWERS</LastName>
                 <Suffix>III</Suffix>
                 <Gender>FEMALE</Gender>
                 <RelationToPrimary>CHILD</RelationToPrimary>
                 <SecureIDValue>123-45-6789</SecureIDValue>
                 <SecureIDType>SSN</SecureIDType>
                 <USCitizen>Yes</USCitizen>
        </Children>
</User>

Please let me know if you need any more information.

Thanks and Regards,
Rajeeva Lochana BR



Reply | Threaded
Open this post in threaded view
|

Re: How to pre-populate the value from xslt to Orbeon form

Rajeeva Lochana BR
This post was updated on .

I figured out answer my self.


working example:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xsl:output method="xml" indent="yes" />
       
    <xsl:variable name="config" select="document('./configuration.xml')"/> 
               
<xsl:variable name="children-grid">
        <children-grid>
                <xsl:for-each select="/User/Children">                       
                        <children-grid-iteration>
                                <child-date-of-birth><xsl:value-of select="DateOfBirth"/></child-date-of-birth>
                                <child-us-citizen><xsl:value-of select="USCitizen"/></child-us-citizen>
                                <child-gender/>
                                <child-ssn/>
                                <child-first-name/>
                                <child-mi/>
                                <child-last-name/>
                                <child-suffix/>
                        </children-grid-iteration>                       
                </xsl:for-each>
        </children-grid>
</xsl:variable>
                                                                                   
        <xsl:template match="/">
                        <section-1>
                                <xsl:copy-of select="$children-grid">
                                        </xsl:copy-of>                       
                        </section-1>
        </xsl:template>
               
</xsl:stylesheet>