Subversion Repositories SmartDukaan

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
84 naveen 1
<?xml version="1.0"?>
2
 
3
<xsl:stylesheet version="1.0"
4
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5
 
6
<xsl:template match="/">
7
    <SolrSchema>
8
        <field name="ID" type="long" indexed="true" stored="true" multiValued="false" required="true"/>
9
        <field name="Name" type="string" indexed="true" stored="false" multiValued="false" required="true"/>
10
        <field name="Category" type="string" indexed="true" stored="false" multiValued="true" required="true"/>
11
        <xsl:apply-templates/>
12
    </SolrSchema>
13
</xsl:template>
14
 
15
<xsl:template match="Facet">
16
    <xsl:comment>
17
        <xsl:value-of select="Label"/>
18
    </xsl:comment>
19
    <xsl:text>
20
 
21
    </xsl:text>
22
    <field>
23
        <xsl:attribute name="name">
24
            <xsl:text>F_</xsl:text><xsl:value-of select="FacetDefinitionID"/>
25
        </xsl:attribute>
26
 
27
        <xsl:attribute name="type">
28
            <xsl:variable name="dt">
29
                <xsl:value-of select="Datatype"/>
30
            </xsl:variable>
31
            <xsl:choose>
32
                <xsl:when test="($dt = 'integer')">
33
                    <xsl:text>int</xsl:text>
34
                </xsl:when>
35
                <xsl:when test="($dt = 'decimal')">
36
                    <xsl:text>float</xsl:text>
37
                </xsl:when>
38
                <xsl:when test="($dt = 'string')">
39
                    <xsl:text>string</xsl:text>
40
                </xsl:when>
41
                <xsl:otherwise>
42
                    <xsl:text>string</xsl:text>
43
                </xsl:otherwise>
44
            </xsl:choose>
45
        </xsl:attribute>
46
 
47
        <xsl:attribute name="indexed"><xsl:text>true</xsl:text></xsl:attribute>
48
 
49
        <xsl:attribute name="stored"><xsl:text>false</xsl:text></xsl:attribute>
50
 
51
        <xsl:attribute name="multiValued">
52
            <xsl:value-of select="IsMultivalue"/>
53
        </xsl:attribute>
54
 
55
        <xsl:attribute name="required"><xsl:text>false</xsl:text></xsl:attribute>
56
    </field>
57
</xsl:template>
58
 
59
<xsl:template match="Property">
60
    <xsl:comment>
61
        <xsl:value-of select="@label"/>
62
    </xsl:comment>
63
    <xsl:text>
64
 
65
    </xsl:text>
66
    <field>
67
        <xsl:attribute name="name">
68
            <xsl:text>P_</xsl:text><xsl:value-of select="@ID"/>
69
        </xsl:attribute>
70
 
71
        <xsl:attribute name="type">
72
            <xsl:variable name="dt">
73
                <xsl:value-of select="@datatype"/>
74
            </xsl:variable>
75
            <xsl:choose>
76
                <xsl:when test="($dt = 'integer')">
77
                    <xsl:text>int</xsl:text>
78
                </xsl:when>
79
                <xsl:when test="($dt = 'decimal')">
80
                    <xsl:text>float</xsl:text>
81
                </xsl:when>
82
                <xsl:when test="($dt = 'string')">
83
                    <xsl:text>text</xsl:text>
84
                </xsl:when>
85
                <xsl:otherwise>
86
                    <xsl:text>text</xsl:text>
87
                </xsl:otherwise>
88
            </xsl:choose>
89
        </xsl:attribute>
90
 
91
        <xsl:attribute name="indexed"><xsl:text>true</xsl:text></xsl:attribute>
92
 
93
        <xsl:attribute name="stored"><xsl:text>false</xsl:text></xsl:attribute>
94
 
95
        <xsl:attribute name="multiValued">
96
            <xsl:value-of select="@isMultivalue"/>
97
        </xsl:attribute>
98
 
99
        <xsl:attribute name="required"><xsl:text>false</xsl:text></xsl:attribute>
100
    </field>
101
</xsl:template>
102
</xsl:stylesheet>