. , .
: , .. , item html , ( container ).
xsl/template.xsl :
<xsl:template match="item" mode="html"> <xsl:value-of select="@title"/> <xsl:value-of select="." disable-output-escaping="yes" /> </xsl:template>
item . ( title ) . <xsl:value-of select="." disable-output-escaping="yes" /> , ( . ) - disable-output-escaping "" , .. " ". .
, , , XHTML . XSLT ( <br> ) . (- ) , , : CDATA . CDATA , , . CDATA ' <![CDATA[' ']]> '. ' ]]> '. , CDATA XSL- " ".
, . , xsl/my_template/layout.xsl .
, XHTML- :
- . ( ) xsl/template.xsl :
<xsl:template match="content">
</xsl:template>
content . , xsl/my_template/layout.xsl , . :
<xsl:apply-templates select="content"/>
xsl/template.xsl :
<xsl:template match="content">
<xsl:apply-templates select="item[@container = 1]" mode="html"/>
<xsl:apply-templates select="item[@container = 2]" mode="html"/>
</xsl:template>
, XML- .
- .
XML- - . , ( ) section . , .
xsl/navigation.xsl <xsl:template match="sections" mode="global_menu"> :
<xsl:template match="sections" mode="global_menu">
</xsl:template>
, , section=1 .
, <xsl:when test="descendant-or-self::*/@id = /node()/@id"> ( ). , ( - ): id .
, XML- CMS : <sections hit_id="2"> . , sections item - . . item :
<xsl:apply-templates select="item[@section=1]" mode="global_menu"> <xsl:with-param name="cur"><xsl:value-of select="@hit_id"/></xsl:with-param> </xsl:apply-templates>
<xsl:apply-templates/> ( ) <xsl:with-param name="cur"> , - cur .
, <xsl:template match="item" mode="global_menu"> :
<xsl:when test="descendant-or-self::*/@id = $cur"> <xsl:value-of select="title"/> </xsl:when>
$cur . , : descendant-or-self::*/@id , @id , .. ? , , - . descendant-or-self::*/@id id .
, : - ; - . , , - :
<xsl:template match="item" mode="global_menu"> <xsl:choose>
<xsl:when test="descendant-or-self::*/@id = $cur"> <xsl:attribute name="id"><xsl:text>cur</xsl:text></xsl:attribute>
<xsl:if test="descendant::*/@id = $cur"> <xsl:call-template name="href_attribute"/> </xsl:if> <xsl:value-of select="title"/>
</xsl:when>
<xsl:otherwise> <xsl:call-template name="href_attribute"/> <xsl:value-of select="title"/>
</xsl:otherwise> </xsl:choose>
</xsl:template>
: <xsl:if test="descendant::*/@id = $cur"></xsl:if>
xsl:if . xsl:choose , , . , descendant::*/@id - id $cur .
- ( ) .
, . xsl/template.xsl <xsl:template match="content"> :
<xsl:template match="content">
<xsl:apply-templates select="item[@container = 1]" mode="html"/>
<xsl:if test="//navigation/sections/item[descendant-or-self::*/@id = //navigation/sections/@hit_id]/item/@id"> <xsl:apply-templates select="//navigation/sections/item[descendant-or-self::*/@id = //navigation/sections/@hit_id]" mode="sub-menu"> <xsl:with-param name="cur"><xsl:value-of select="//navigation/sections/@hit_id"/></xsl:with-param> </xsl:apply-templates>
</xsl:if>
<xsl:apply-templates select="item[@container = 2]" mode="html"/>
</xsl:template>
:
<xsl:if test="//navigation/sections/item[descendant-or-self::*/@id = //navigation/sections/@hit_id]/item/@id">
, .
, : <xsl:apply-templates select="item" mode="sub-menu">
, xsl/my_template/navigation.xsl :
<xsl:template match="item" mode="sub-menu">
</xsl:template>
, , . , .
CSS . , DIV- , .. , XSLT , . , navigation.xsl .
, - . , . , <xsl:apply-templates select="item" mode="sub-menu-items"> :
<xsl:template match="item" mode="sub-menu-items"> <xsl:choose>
<xsl:when test="descendant-or-self::*/@id = $cur"> <xsl:attribute name="id"><xsl:text>cur</xsl:text></xsl:attribute>
<xsl:if test="descendant::*/@id = $cur"> <xsl:call-template name="href_attribute"/> </xsl:if> <xsl:value-of select="title"/> </xsl:when>
<xsl:otherwise> <xsl:call-template name="href_attribute"/> <xsl:value-of select="title"/>
</xsl:otherwise> </xsl:choose>
<xsl:if test="item/@id">
</xsl:if>
</xsl:template>
- item item , <xsl:template match="item" mode="sub-menu-items"> .
тАж
PS . , XSL-.
UPD: . , XSLT.
| . , .
: , .. , item html , ( container ).
xsl/template.xsl :
<xsl:template match="item" mode="html"> <xsl:value-of select="@title"/> <xsl:value-of select="." disable-output-escaping="yes" /> </xsl:template>
item . ( title ) . <xsl:value-of select="." disable-output-escaping="yes" /> , ( . ) - disable-output-escaping "" , .. " ". .
, , , XHTML . XSLT ( <br> ) . (- ) , , : CDATA . CDATA , , . CDATA ' <![CDATA[' ']]> '. ' ]]> '. , CDATA XSL- " ".
, . , xsl/my_template/layout.xsl .
, XHTML- :
- . ( ) xsl/template.xsl :
<xsl:template match="content">
</xsl:template>
content . , xsl/my_template/layout.xsl , . :
<xsl:apply-templates select="content"/>
xsl/template.xsl :
<xsl:template match="content">
<xsl:apply-templates select="item[@container = 1]" mode="html"/>
<xsl:apply-templates select="item[@container = 2]" mode="html"/>
</xsl:template>
, XML- .
- .
XML- - . , ( ) section . , .
xsl/navigation.xsl <xsl:template match="sections" mode="global_menu"> :
<xsl:template match="sections" mode="global_menu">
</xsl:template>
, , section=1 .
, <xsl:when test="descendant-or-self::*/@id = /node()/@id"> ( ). , ( - ): id .
, XML- CMS : <sections hit_id="2"> . , sections item - . . item :
<xsl:apply-templates select="item[@section=1]" mode="global_menu"> <xsl:with-param name="cur"><xsl:value-of select="@hit_id"/></xsl:with-param> </xsl:apply-templates>
<xsl:apply-templates/> ( ) <xsl:with-param name="cur"> , - cur .
, <xsl:template match="item" mode="global_menu"> :
<xsl:when test="descendant-or-self::*/@id = $cur"> <xsl:value-of select="title"/> </xsl:when>
$cur . , : descendant-or-self::*/@id , @id , .. ? , , - . descendant-or-self::*/@id id .
, : - ; - . , , - :
<xsl:template match="item" mode="global_menu"> <xsl:choose>
<xsl:when test="descendant-or-self::*/@id = $cur"> <xsl:attribute name="id"><xsl:text>cur</xsl:text></xsl:attribute>
<xsl:if test="descendant::*/@id = $cur"> <xsl:call-template name="href_attribute"/> </xsl:if> <xsl:value-of select="title"/>
</xsl:when>
<xsl:otherwise> <xsl:call-template name="href_attribute"/> <xsl:value-of select="title"/>
</xsl:otherwise> </xsl:choose>
</xsl:template>
: <xsl:if test="descendant::*/@id = $cur"></xsl:if>
xsl:if . xsl:choose , , . , descendant::*/@id - id $cur .
- ( ) .
, . xsl/template.xsl <xsl:template match="content"> :
<xsl:template match="content">
<xsl:apply-templates select="item[@container = 1]" mode="html"/>
<xsl:if test="//navigation/sections/item[descendant-or-self::*/@id = //navigation/sections/@hit_id]/item/@id"> <xsl:apply-templates select="//navigation/sections/item[descendant-or-self::*/@id = //navigation/sections/@hit_id]" mode="sub-menu"> <xsl:with-param name="cur"><xsl:value-of select="//navigation/sections/@hit_id"/></xsl:with-param> </xsl:apply-templates>
</xsl:if>
<xsl:apply-templates select="item[@container = 2]" mode="html"/>
</xsl:template>
:
<xsl:if test="//navigation/sections/item[descendant-or-self::*/@id = //navigation/sections/@hit_id]/item/@id">
, .
, : <xsl:apply-templates select="item" mode="sub-menu">
, xsl/my_template/navigation.xsl :
<xsl:template match="item" mode="sub-menu">
</xsl:template>
, , . , .
CSS . , DIV- , .. , XSLT , . , navigation.xsl .
, - . , . , <xsl:apply-templates select="item" mode="sub-menu-items"> :
<xsl:template match="item" mode="sub-menu-items"> <xsl:choose>
<xsl:when test="descendant-or-self::*/@id = $cur"> <xsl:attribute name="id"><xsl:text>cur</xsl:text></xsl:attribute>
<xsl:if test="descendant::*/@id = $cur"> <xsl:call-template name="href_attribute"/> </xsl:if> <xsl:value-of select="title"/> </xsl:when>
<xsl:otherwise> <xsl:call-template name="href_attribute"/> <xsl:value-of select="title"/>
</xsl:otherwise> </xsl:choose>
<xsl:if test="item/@id">
</xsl:if>
</xsl:template>
- item item , <xsl:template match="item" mode="sub-menu-items"> .
тАж
PS . , XSL-.
UPD: . , XSLT.
|