Subversion Repositories SmartDukaan

Rev

Rev 323 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
    <add>
        <xsl:apply-templates/>
    </add>
</xsl:template>

<xsl:template match="Entity">
    <doc>
        <field name="ID">
            <xsl:value-of select="@ID"/>
        </field>
        <field name="Category">
            <xsl:value-of select="Category"/>
        </field>
        
        
        <xsl:choose>
                <xsl:when test="Boost &gt; 0">
                        <field name="Name" boost="5">
                        <xsl:value-of select="Title"/>
                        </field>
                </xsl:when>
                <xsl:otherwise>
                        <field name="Name">
                        <xsl:value-of select="Title"/>
                        </field>
                </xsl:otherwise>
        </xsl:choose>
    
                
        <xsl:apply-templates/>
    </doc>
</xsl:template>

<xsl:template match="Facet">
    <xsl:for-each select="Value">
        <field>
            <xsl:attribute name="name">
                <xsl:text>F_</xsl:text><xsl:value-of select="../@ID"/>
            </xsl:attribute>
            <xsl:value-of select="."/>
        </field>
    </xsl:for-each>
</xsl:template>

<xsl:template match="Property">
    <xsl:for-each select="Value">
        <field>
            <xsl:attribute name="name">
                <xsl:text>P_</xsl:text><xsl:value-of select="../@ID"/>
            </xsl:attribute>
            <xsl:value-of select="."/>
        </field>
    </xsl:for-each>
</xsl:template>
</xsl:stylesheet>