рдкреНрд░реИрдХреНрдЯрд┐рдХрд▓ рдПрдХреНрд╕рдПрд╕рдПрд▓рдЯреАред рдПрдХ рдЯреЗрдореНрдкрд▓реЗрдЯ рдЗрдВрдЬрди рдХреЗ рд░реВрдк рдореЗрдВ рдЙрдкрдпреЛрдЧ рдХрд░реЗрдВ

XSL рднрд╛рд╖рд╛ рдкрд░ рдмрд╣реБрдд рд╕рд╛рд░реЗ рджрд╕реНрддрд╛рд╡реЗрдЬрд╝ рдСрдирд▓рд╛рдЗрди рдЙрдкрд▓рдмреНрдз рд╣реИрдВред рдпрд╣ рдЦрдВрдб рднрд╛рд╖рд╛ рдХреЗ рджрд╕реНрддрд╛рд╡реЗрдЬ рд╣реЛрдиреЗ рдХрд╛ рджрд┐рдЦрд╛рд╡рд╛ рдирд╣реАрдВ рдХрд░рддрд╛ рд╣реИ, рд▓реЗрдХрд┐рди рдХреЗрд╡рд▓ рд╕рдВрдХреНрд╖реЗрдк рдореЗрдВ, рдЪрд░рдг рджрд░ рдЪрд░рдг рдпрд╣ рдмрддрд╛рддрд╛ рд╣реИ рдХрд┐ рдЕрдкрдирд╛ рдЦреБрдж рдХрд╛ XSLT рдЯреЗрдореНрдкрд▓реЗрдЯ рдХреИрд╕реЗ рдмрдирд╛рдпрд╛ рдЬрд╛рдПред



рдиреАрдЪреЗ рд╡рд░реНрдгрд┐рдд рдпреЛрдЬрдирд╛ рдХрд╛ рдореЗрд░реЗ рджреНрд╡рд╛рд░рд╛ 3 рд╡рд░реНрд╖реЛрдВ рд╕реЗ рдЕрдзрд┐рдХ рд╕рдордп рд╕реЗ рд╕рдлрд▓рддрд╛рдкреВрд░реНрд╡рдХ рдЙрдкрдпреЛрдЧ рдХрд┐рдпрд╛ рдЬрд╛ рд░рд╣рд╛ рд╣реИред рд╕рдмрд╕реЗ рдкрд╣рд▓реЗ, рдореИрдВ рдПрдХреНрд╕рдПрд╕рдПрд▓рдЯреА рд╕реЗ рдмрд╣реБрдд рд╕рд╛рд╡рдзрд╛рди рдерд╛ (рд╡рд┐рд╢реЗрд╖рдХрд░ рдЬрдм рдореИрдВ рдЕрдиреНрдп рд▓реЛрдЧреЛрдВ рдХреЗ рд╕реНрд░реЛрддреЛрдВ рдХреЛ рдирд╖реНрдЯ рдХрд░ рд░рд╣рд╛ рдерд╛), рд▓реЗрдХрд┐рди рдПрдХ рдмрд╛рд░ рдореБрдЭреЗ рдПрд╣рд╕рд╛рд╕ рд╣реБрдЖ рдХрд┐ рдореИрдВ рдХрд▓реНрдкрдирд╛ рдирд╣реАрдВ рдХрд░ рд╕рдХрддрд╛ рдХрд┐ рдЖрдк рдЗрд╕рдХреЗ рдмрд┐рдирд╛ рдХреИрд╕реЗ рдХрд╛рдо рдХрд░ рд╕рдХрддреЗ рд╣реИрдВред



рдХрд╛рдо рдХреА рдореЗрдЬ

рдкрд░рд┐рднрд╛рд╖рд┐рдд рдХрд░реЗрдВ рдХрд┐ рд╣рдореЗрдВ рдХреНрдпрд╛ рдХрд╛рдо рдХрд░рдирд╛ рд╣реИ:



рдореЗрд░реЗ рдкрд╛рд╕ рд╕реАрдПрдордПрд╕-рд╕рд┐рд╕реНрдЯрдо рджреНрд╡рд╛рд░рд╛ рдЬрд╛рд░реА рдПрдХ рдПрдХреНрд╕рдПрдордПрд▓ рдЗрдирдкреБрдЯ рдбреЙрдХреНрдпреВрдореЗрдВрдЯ рд╣реИ, рдЬрд┐рд╕рдореЗрдВ рд╕рд╛рдордЧреНрд░реА рдХреЗ рд╕рд╛рде рдкреНрд░рддреНрдпреЗрдХ рдкреГрд╖реНрда рдХреЛ рдПрдХреНрд╕рдПрдордПрд▓-рдЯреНрд░реА рдореЗрдВ рдЗрдХрдЯреНрдард╛ рдХрд┐рдпрд╛ рдЧрдпрд╛ рд╣реИред



XHTML рд▓реЗрдЖрдЙрдЯ рдкрд░ рдХреЛрдИ рдкреНрд░рддрд┐рдмрдВрдз рдирд╣реАрдВ рд╣реИрдВред рд▓реЗрдЖрдЙрдЯ рдХреЗ рд▓рд┐рдП рдХреЗрд╡рд▓ рдХреБрдЫ рд╕рд┐рдлрд╛рд░рд┐рд╢реЗрдВ рд╣реИрдВ, рдЬреЛ рдЯреЗрдореНрдкрд▓реЗрдЯ рдХреЗ рдЧрдарди рдкрд░ рд╕рдордп рдХреА рдмрдЪрдд рдХрд░реЗрдЧрд╛ред



рдЖрдк рдЕрдВрддрд┐рдо рджрд╕реНрддрд╛рд╡реЗрдЬрд╝ рдХреЗ рдПрдХ рдкрд╛рд░реНрд╕рд░ (рдХрд▓реЗрдХреНрдЯрд░) рдХреЗ рд░реВрдк рдореЗрдВ рдПрдХ рдмреНрд░рд╛рдЙрдЬрд╝рд░ рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд░ рд╕рдХрддреЗ рд╣реИрдВред рдЖрдкрдХреЛ рдмрд╕ XML рджрд╕реНрддрд╛рд╡реЗрдЬрд╝реЛрдВ рдореЗрдВ рдЯреЗрдореНрдкреНрд▓реЗрдЯ рдлрд╝рд╛рдЗрд▓ рдХрд╛ рдкрде рдирд┐рд░реНрджрд┐рд╖реНрдЯ рдХрд░рдирд╛ рд╣реЛрдЧрд╛:

<?xml-stylesheet type="text/xsl" href="template.xsl" ?>







рдпрджреНрдпрдкрд┐, рдЬреИрд╕рд╛ рдХрд┐ рдЕрднреНрдпрд╛рд╕ рд╕реЗ рдкрддрд╛ рдЪрд▓рд╛ рд╣реИ, рдпрд╣ рддрдВрддреНрд░ рдХрд╛рдлреА рдЫреЛрдЯрд╛ рд╣реИ (рдореБрдЭреЗ IE рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд░рдирд╛ рдкрдбрд╝рд╛)ред рднрд╛рд╖рд╛ рдХреЗ XML рдкрд╛рд░реНрд╕рд┐рдВрдЧ рдЯреВрд▓ рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд░рдирд╛ рдмреЗрд╣рддрд░ рд╣реИ рдЬрд┐рд╕рдореЗрдВ рд╕реАрдПрдордПрд╕ рд╕рд┐рд╕реНрдЯрдо рд▓рд┐рдЦрд╛ рдЧрдпрд╛ рд╣реИред рдореИрдВ рдкрд╛рд░реНрд╕рд░ рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд░рддрд╛ рд╣реВрдВ (рдЗрд╕ рдкрд░, рд╡рд╛рд╕реНрддрд╡ рдореЗрдВ, рдореЗрд░реЗ рдкрд╛рд╕ рдкреВрд░реА рдкреНрд░рдгрд╛рд▓реА рдХрд╛рдо рдХрд░ рд░рд╣реА рд╣реИ)ред



XML рдЗрдирдкреБрдЯ рджрд╕реНрддрд╛рд╡реЗрдЬрд╝

рд╕рдмрд╕реЗ рдкрд╣рд▓реЗ, рдЪрд▓реЛ рдЗрдирдкреБрдЯ рдПрдХреНрд╕рдПрдордПрд▓ рджрд╕реНрддрд╛рд╡реЗрдЬрд╝ рдХрд╛ рдкрддрд╛ рд▓рдЧрд╛рддреЗ рд╣реИрдВ ред XSL рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рдЖрдкрдХреЛ рдЗрд╕рдХреА рд╕рдВрд░рдЪрдирд╛ рдХреА рдкреВрд░реА рд╕рдордЭ рд╣реЛрдиреА рдЪрд╛рд╣рд┐рдПред



рдореИрдВ рдирд┐рдореНрдирд▓рд┐рдЦрд┐рдд рдпреЛрдЬрдирд╛ рдХрд╛ рдЙрдкрдпреЛрдЧ рдХрд░рддрд╛ рд╣реВрдВ:

<?xml version="1.0" encoding="windows-1251"?>







<lang_table>

/>

</lang_table>

<item id="0" parent_id="0" is_published="1" section="1">



/



<item id="1" parent_id="0" is_published="1" section="1">



news



















рдКрдкрд░ рд╡рд░реНрдгрд┐рдд рдЙрджрд╛рд╣рд░рдг рд╕рд░реНрдХрд┐рдЯ рдЗрд╖реНрдЯрддрдо рд╣реЛрдиреЗ рдХрд╛ рджрд╛рд╡рд╛ рдирд╣реАрдВ рдХрд░рддрд╛ рд╣реИред рдПрдХ рдХрд╛рд░рдг рдпрд╛ рдХрд┐рд╕реА рдЕрдиреНрдп рдХреЗ рд▓рд┐рдП, рдпрд╣ рдореЗрд░реЗ рд▓рд┐рдП рд╕реБрд╡рд┐рдзрд╛рдЬрдирдХ рд╣реИред рд▓реЗрдХрд┐рди, рдкрд╣рд▓реА рдЪреАрдЬреЗрдВ рдкрд╣рд▓реЗред



<?xml version="1.0" encoding="windows-1251"?>



- XML рдлрд╝рд╛рдЗрд▓ рдХрд╛ рд╢реАрд░реНрд╖рд▓реЗрдЦред рдлрд╝рд╛рдЗрд▓ рдХреА рд╢реБрд░реБрдЖрдд рд╕реЗ рд╕рдЦреНрддреА рд╕реЗ рдЬрд╛рдирд╛ рдЪрд╛рд╣рд┐рдПред рдЗрд╕рдореЗрдВ рдЙрдкрдпреЛрдЧ рдХреА рдЧрдИ XML рднрд╛рд╖рд╛ рдХрд╛ рд╕рдВрд╕реНрдХрд░рдг рдФрд░ рджрд╕реНрддрд╛рд╡реЗрдЬрд╝ рдХреА рдПрдиреНрдХреЛрдбрд┐рдВрдЧ рд╢рд╛рдорд┐рд▓ рд╣реИред рдореИрдВ рдЖрдорддреМрд░ рдкрд░ рд╡рд┐рдВрдбреЛрдЬрд╝ -1251 (рдЕрдм рддрдХ рдЕрдзрд┐рдХ рд╕реБрд╡рд┐рдзрд╛рдЬрдирдХ) рдореЗрдВ рдХрд╛рдо рдХрд░рддрд╛ рд╣реВрдВ, рд▓реЗрдХрд┐рди, рд╕рд┐рджреНрдзрд╛рдВрдд рд░реВрдк рдореЗрдВ, рдпреВрдЯреАрдПрдл -8 рдмреЗрд╣рддрд░ рд╣реИред



- ( ). :

Lang - . . Id - .

<lang_table> - , .

- :

- ( ):

<item id="0" parent_id="0" is_published="1" section="1">




- . :

Id - . Parent_id - . Is_published - . Dir - uri- . . Section - . .

- .

CMS : :

Html - . , . Com - -. , CMS: , , ..

XSL- , . .



CMS , :

:

Id - .

Container - - ( ).

Sorting - .

Type - :

Com - -

Html - .

Method - .

Title - .

DTD ( ):

<!DOCTYPE site_page [



<!ENTITY nbsp " ">

<!ENTITY sect "┬з" >

<!ENTITY copy "┬й">

<!ENTITY laquo "┬л">

<!ENTITY reg "┬о">

<!ENTITY deg "┬░">

<!ENTITY plusmn "┬▒">

<!ENTITY para "┬╢">

<!ENTITY raquo "┬╗">

<!ENTITY times "├Ч">







<!ENTITY bull "тАв">

<!ENTITY hellip "тАж">







<!ENTITY ndash "тАУ">

<!ENTITY mdash "тАФ">

<!ENTITY lsquo "'">

<!ENTITY rsquo "'">

<!ENTITY sbquo "тАЪ">

<!ENTITY ldquo "тАЬ">

<!ENTITY rdquo "тАЭ">

<!ENTITY bdquo "тАЮ">

<!ENTITY lsaquo "тА╣">

<!ENTITY rsaquo "тА║" >

<!ENTITY euro "тВм">

]>







XML- . <?xml version="1.0" encoding="windows-1251"?>



.



XHML-

XSL- XHTML- ( ). XHTML-, , .



.



XHML- , , :

( ). - , . / .

HTML-:

...









...







...







...







...








XSL-

XSL- :

<xsl:stylesheet version = '1.0' encoding="UTF-8"?>

<xsl:template match="element">



</xsl:template>

</xsl:stylesheet>








: <xsl:stylesheet version = '1.0' encoding="UTF-8"?>



- XML- . UTF-8 ( , ).

<xsl:stylesheet> </xsl:stylesheet>



- XSL-.

<xsl:template match="element"> </xsl:template>



- element.



:

<xsl:template match="element"></xsl:template>



- , element . element . <xsl:template match="element" mode="mode1"></xsl:template>



- , element mode1 . element . <xsl:template name="template-name"></xsl:template>



- template-name . - XML- .

XML- (, XML-, item ), " " :

<xsl:template match="navigation/sections/item"></xsl:template>





, , .., , , , .. navigation , navigation/sections/item sections/item .





, - . , xsl- . .



xsl .



, ( ) :

template_folder - . , my_template . dtd - . . lang - ( ). mod - .

xsl/my_template , layout.xsl :

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE xsl:stylesheet SYSTEM "../dtd/entities.dtd">

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



<xsl:template match="/node()">

</xsl:template>



</xsl:stylesheet>







:

<xsl:template match="/node()"> </xsl:template>



- /node() (). /node() //document , .. .



XHTML- <xsl:template match="/node()"></xsl:template>







XML- . , XSL- XML- XHTML- .



, XSL template.xsl (, template - ), :

<?xml version="1.0" encoding="UTF-8"?>

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



<xsl:import href=" my_template /layout.xsl"/>

</xsl:stylesheet>







:

<xsl:import href="my_template/layout.xsl"/>





XSL- ( XSL- ) . .





, .. XML- .



- .



, XML- :



<item id="0" parent_id="0" is_published="1" section="1">



/



<item id="1" parent_id="0" is_published="1" section="1" hit="yes">



news













:

id document - id . hit item - , , " ".

, , :

sections - . item - .

, , item item , , :













1. xsl/my_template navigation.xsl :

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE xsl:stylesheet SYSTEM "../dtd/entities.dtd">

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



<xsl:template match="sections" mode="global_menu">

</xsl:template>



</xsl:stylesheet>








2. layout.xsl :



<xsl:template match="sections" mode="global_menu">



</xsl:template>









3. тАж layout.xsl :



<xsl:apply-templates select="navigation/sections" mode="global_menu"/>









:

select="navigation/sections" - ( ) - . , navigation/sections .



mode="global_menu" - global_menu . , , , " ", - .



4. , layout.xsl navigation.xsl :

<xsl:import href="navigation.xsl"/>







5. , navigation.xsl , :



<xsl:template match="item" mode="global_menu">

<xsl:call-template name="href_attribute"/>

<xsl:value-of select="title"/>





</xsl:template>









:

<xsl:call-template name="href_attribute"/>



- . , .. .



<xsl:value-of select="title"/>



- - title . @ - .



6. sections :



<xsl:template match="sections" mode="global_menu">



</xsl:template>









:

<xsl:apply-templates select="item" mode="global_menu"/>



- item sections . , item item ( sections/item/item ) , .. .



item ( ) . , : <xsl:call-template name="href_attribute"/>







uri- . .



7. ,

, . item :



<xsl:template match="item" mode="global_menu">



<xsl:choose>



<xsl:when test="descendant-or-self::*/@id = /node()/@id">

<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:choose>

<xsl:when></xsl:when>

<xsl:otherwise></xsl:otherwise>

</xsl:choose>







тАж, , XML- . : <xsl:when test="descendant-or-self::*/@id = /node()/@id">







ID ( document ) ( item ), , .



<xsl:when></xsl:when>



, . <xsl:otherwise></xsl:otherwise>



- .



8. , href_attribute :



<xsl:template name="href_attribute">

<xsl:attribute name="href">

<xsl:text>/</xsl:text>

<xsl:for-each select="ancestor-or-self::item">

<xsl:value-of select="dir"/>

<xsl:text>/</xsl:text>

</xsl:for-each>

</xsl:attribute>

</xsl:template>









xsl:attribute . . a , , href , .. .



<xsl:for-each select="ancestor-or-self::item">



, . ancestor-or-self::item - . dir , .. -.



, - , . , .



UPD:

. , :

parser.proc.ru/iso/xslt-1.zip



( ) Apache.



XML- /xsl/document.xml
























- ( ). :

Lang - . . Id - .

<lang_table>




- , .

- :

- ( ):

<item id="0" parent_id="0" is_published="1" section="1">




- . :

Id - . Parent_id - . Is_published - . Dir - uri- . . Section - . .

- .

CMS : :

Html - . , . Com - -. , CMS: , , ..

XSL- , . .



CMS , :

:

Id - .

Container - - ( ).

Sorting - .

Type - :

Com - -

Html - .

Method - .

Title - .

DTD ( ):

<!DOCTYPE site_page [



<!ENTITY nbsp " ">

<!ENTITY sect "┬з" >

<!ENTITY copy "┬й">

<!ENTITY laquo "┬л">

<!ENTITY reg "┬о">

<!ENTITY deg "┬░">

<!ENTITY plusmn "┬▒">

<!ENTITY para "┬╢">

<!ENTITY raquo "┬╗">

<!ENTITY times "├Ч">







<!ENTITY bull "тАв">

<!ENTITY hellip "тАж">







<!ENTITY ndash "тАУ">

<!ENTITY mdash "тАФ">

<!ENTITY lsquo "'">

<!ENTITY rsquo "'">

<!ENTITY sbquo "тАЪ">

<!ENTITY ldquo "тАЬ">

<!ENTITY rdquo "тАЭ">

<!ENTITY bdquo "тАЮ">

<!ENTITY lsaquo "тА╣">

<!ENTITY rsaquo "тА║" >

<!ENTITY euro "тВм">

]>







XML- . <?xml version="1.0" encoding="windows-1251"?>



.



XHML-

XSL- XHTML- ( ). XHTML-, , .



.



XHML- , , :

( ). - , . / .

HTML-:

...









...







...







...







...








XSL-

XSL- :

<xsl:stylesheet version = '1.0' encoding="UTF-8"?>

<xsl:template match="element">



</xsl:template>

</xsl:stylesheet>








: <xsl:stylesheet version = '1.0' encoding="UTF-8"?>



- XML- . UTF-8 ( , ).

<xsl:stylesheet> </xsl:stylesheet>



- XSL-.

<xsl:template match="element"> </xsl:template>



- element.



:

<xsl:template match="element"></xsl:template>



- , element . element . <xsl:template match="element" mode="mode1"></xsl:template>



- , element mode1 . element . <xsl:template name="template-name"></xsl:template>



- template-name . - XML- .

XML- (, XML-, item ), " " :

<xsl:template match="navigation/sections/item"></xsl:template>





, , .., , , , .. navigation , navigation/sections/item sections/item .





, - . , xsl- . .



xsl .



, ( ) :

template_folder - . , my_template . dtd - . . lang - ( ). mod - .

xsl/my_template , layout.xsl :

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE xsl:stylesheet SYSTEM "../dtd/entities.dtd">

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



<xsl:template match="/node()">

</xsl:template>



</xsl:stylesheet>







:

<xsl:template match="/node()"> </xsl:template>



- /node() (). /node() //document , .. .



XHTML- <xsl:template match="/node()"></xsl:template>







XML- . , XSL- XML- XHTML- .



, XSL template.xsl (, template - ), :

<?xml version="1.0" encoding="UTF-8"?>

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



<xsl:import href=" my_template /layout.xsl"/>

</xsl:stylesheet>







:

<xsl:import href="my_template/layout.xsl"/>





XSL- ( XSL- ) . .





, .. XML- .



- .



, XML- :



<item id="0" parent_id="0" is_published="1" section="1">



/



<item id="1" parent_id="0" is_published="1" section="1" hit="yes">



news













:

id document - id . hit item - , , " ".

, , :

sections - . item - .

, , item item , , :













1. xsl/my_template navigation.xsl :

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE xsl:stylesheet SYSTEM "../dtd/entities.dtd">

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



<xsl:template match="sections" mode="global_menu">

</xsl:template>



</xsl:stylesheet>








2. layout.xsl :



<xsl:template match="sections" mode="global_menu">



</xsl:template>









3. тАж layout.xsl :



<xsl:apply-templates select="navigation/sections" mode="global_menu"/>









:

select="navigation/sections" - ( ) - . , navigation/sections .



mode="global_menu" - global_menu . , , , " ", - .



4. , layout.xsl navigation.xsl :

<xsl:import href="navigation.xsl"/>







5. , navigation.xsl , :



<xsl:template match="item" mode="global_menu">

<xsl:call-template name="href_attribute"/>

<xsl:value-of select="title"/>





</xsl:template>









:

<xsl:call-template name="href_attribute"/>



- . , .. .



<xsl:value-of select="title"/>



- - title . @ - .



6. sections :



<xsl:template match="sections" mode="global_menu">



</xsl:template>









:

<xsl:apply-templates select="item" mode="global_menu"/>



- item sections . , item item ( sections/item/item ) , .. .



item ( ) . , : <xsl:call-template name="href_attribute"/>







uri- . .



7. ,

, . item :



<xsl:template match="item" mode="global_menu">



<xsl:choose>



<xsl:when test="descendant-or-self::*/@id = /node()/@id">

<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:choose>

<xsl:when></xsl:when>

<xsl:otherwise></xsl:otherwise>

</xsl:choose>







тАж, , XML- . : <xsl:when test="descendant-or-self::*/@id = /node()/@id">







ID ( document ) ( item ), , .



<xsl:when></xsl:when>



, . <xsl:otherwise></xsl:otherwise>



- .



8. , href_attribute :



<xsl:template name="href_attribute">

<xsl:attribute name="href">

<xsl:text>/</xsl:text>

<xsl:for-each select="ancestor-or-self::item">

<xsl:value-of select="dir"/>

<xsl:text>/</xsl:text>

</xsl:for-each>

</xsl:attribute>

</xsl:template>









xsl:attribute . . a , , href , .. .



<xsl:for-each select="ancestor-or-self::item">



, . ancestor-or-self::item - . dir , .. -.



, - , . , .



UPD:

. , :

parser.proc.ru/iso/xslt-1.zip



( ) Apache.



XML- /xsl/document.xml




















- ( ). :

Lang - . . Id - .

<lang_table>




- , .

- :

- ( ):

<item id="0" parent_id="0" is_published="1" section="1">




- . :

Id - . Parent_id - . Is_published - . Dir - uri- . . Section - . .

- .

CMS : :

Html - . , . Com - -. , CMS: , , ..

XSL- , . .



CMS , :

:

Id - .

Container - - ( ).

Sorting - .

Type - :

Com - -

Html - .

Method - .

Title - .

DTD ( ):

<!DOCTYPE site_page [



<!ENTITY nbsp " ">

<!ENTITY sect "┬з" >

<!ENTITY copy "┬й">

<!ENTITY laquo "┬л">

<!ENTITY reg "┬о">

<!ENTITY deg "┬░">

<!ENTITY plusmn "┬▒">

<!ENTITY para "┬╢">

<!ENTITY raquo "┬╗">

<!ENTITY times "├Ч">







<!ENTITY bull "тАв">

<!ENTITY hellip "тАж">







<!ENTITY ndash "тАУ">

<!ENTITY mdash "тАФ">

<!ENTITY lsquo "'">

<!ENTITY rsquo "'">

<!ENTITY sbquo "тАЪ">

<!ENTITY ldquo "тАЬ">

<!ENTITY rdquo "тАЭ">

<!ENTITY bdquo "тАЮ">

<!ENTITY lsaquo "тА╣">

<!ENTITY rsaquo "тА║" >

<!ENTITY euro "тВм">

]>







XML- . <?xml version="1.0" encoding="windows-1251"?>



.



XHML-

XSL- XHTML- ( ). XHTML-, , .



.



XHML- , , :

( ). - , . / .

HTML-:

...









...







...







...







...








XSL-

XSL- :

<xsl:stylesheet version = '1.0' encoding="UTF-8"?>

<xsl:template match="element">



</xsl:template>

</xsl:stylesheet>








: <xsl:stylesheet version = '1.0' encoding="UTF-8"?>



- XML- . UTF-8 ( , ).

<xsl:stylesheet> </xsl:stylesheet>



- XSL-.

<xsl:template match="element"> </xsl:template>



- element.



:

<xsl:template match="element"></xsl:template>



- , element . element . <xsl:template match="element" mode="mode1"></xsl:template>



- , element mode1 . element . <xsl:template name="template-name"></xsl:template>



- template-name . - XML- .

XML- (, XML-, item ), " " :

<xsl:template match="navigation/sections/item"></xsl:template>





, , .., , , , .. navigation , navigation/sections/item sections/item .





, - . , xsl- . .



xsl .



, ( ) :

template_folder - . , my_template . dtd - . . lang - ( ). mod - .

xsl/my_template , layout.xsl :

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE xsl:stylesheet SYSTEM "../dtd/entities.dtd">

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



<xsl:template match="/node()">

</xsl:template>



</xsl:stylesheet>







:

<xsl:template match="/node()"> </xsl:template>



- /node() (). /node() //document , .. .



XHTML- <xsl:template match="/node()"></xsl:template>







XML- . , XSL- XML- XHTML- .



, XSL template.xsl (, template - ), :

<?xml version="1.0" encoding="UTF-8"?>

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



<xsl:import href=" my_template /layout.xsl"/>

</xsl:stylesheet>







:

<xsl:import href="my_template/layout.xsl"/>





XSL- ( XSL- ) . .





, .. XML- .



- .



, XML- :



<item id="0" parent_id="0" is_published="1" section="1">



/



<item id="1" parent_id="0" is_published="1" section="1" hit="yes">



news













:

id document - id . hit item - , , " ".

, , :

sections - . item - .

, , item item , , :













1. xsl/my_template navigation.xsl :

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE xsl:stylesheet SYSTEM "../dtd/entities.dtd">

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



<xsl:template match="sections" mode="global_menu">

</xsl:template>



</xsl:stylesheet>








2. layout.xsl :



<xsl:template match="sections" mode="global_menu">



</xsl:template>









3. тАж layout.xsl :



<xsl:apply-templates select="navigation/sections" mode="global_menu"/>









:

select="navigation/sections" - ( ) - . , navigation/sections .



mode="global_menu" - global_menu . , , , " ", - .



4. , layout.xsl navigation.xsl :

<xsl:import href="navigation.xsl"/>







5. , navigation.xsl , :



<xsl:template match="item" mode="global_menu">

<xsl:call-template name="href_attribute"/>

<xsl:value-of select="title"/>





</xsl:template>









:

<xsl:call-template name="href_attribute"/>



- . , .. .



<xsl:value-of select="title"/>



- - title . @ - .



6. sections :



<xsl:template match="sections" mode="global_menu">



</xsl:template>









:

<xsl:apply-templates select="item" mode="global_menu"/>



- item sections . , item item ( sections/item/item ) , .. .



item ( ) . , : <xsl:call-template name="href_attribute"/>







uri- . .



7. ,

, . item :



<xsl:template match="item" mode="global_menu">



<xsl:choose>



<xsl:when test="descendant-or-self::*/@id = /node()/@id">

<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:choose>

<xsl:when></xsl:when>

<xsl:otherwise></xsl:otherwise>

</xsl:choose>







тАж, , XML- . : <xsl:when test="descendant-or-self::*/@id = /node()/@id">







ID ( document ) ( item ), , .



<xsl:when></xsl:when>



, . <xsl:otherwise></xsl:otherwise>



- .



8. , href_attribute :



<xsl:template name="href_attribute">

<xsl:attribute name="href">

<xsl:text>/</xsl:text>

<xsl:for-each select="ancestor-or-self::item">

<xsl:value-of select="dir"/>

<xsl:text>/</xsl:text>

</xsl:for-each>

</xsl:attribute>

</xsl:template>









xsl:attribute . . a , , href , .. .



<xsl:for-each select="ancestor-or-self::item">



, . ancestor-or-self::item - . dir , .. -.



, - , . , .



UPD:

. , :

parser.proc.ru/iso/xslt-1.zip



( ) Apache.



XML- /xsl/document.xml




















- ( ). :

Lang - . . Id - .

<lang_table>




- , .

- :

- ( ):

<item id="0" parent_id="0" is_published="1" section="1">




- . :

Id - . Parent_id - . Is_published - . Dir - uri- . . Section - . .

- .

CMS : :

Html - . , . Com - -. , CMS: , , ..

XSL- , . .



CMS , :

:

Id - .

Container - - ( ).

Sorting - .

Type - :

Com - -

Html - .

Method - .

Title - .

DTD ( ):

<!DOCTYPE site_page [



<!ENTITY nbsp " ">

<!ENTITY sect "┬з" >

<!ENTITY copy "┬й">

<!ENTITY laquo "┬л">

<!ENTITY reg "┬о">

<!ENTITY deg "┬░">

<!ENTITY plusmn "┬▒">

<!ENTITY para "┬╢">

<!ENTITY raquo "┬╗">

<!ENTITY times "├Ч">







<!ENTITY bull "тАв">

<!ENTITY hellip "тАж">







<!ENTITY ndash "тАУ">

<!ENTITY mdash "тАФ">

<!ENTITY lsquo "'">

<!ENTITY rsquo "'">

<!ENTITY sbquo "тАЪ">

<!ENTITY ldquo "тАЬ">

<!ENTITY rdquo "тАЭ">

<!ENTITY bdquo "тАЮ">

<!ENTITY lsaquo "тА╣">

<!ENTITY rsaquo "тА║" >

<!ENTITY euro "тВм">

]>



XML- . <?xml version="1.0" encoding="windows-1251"?>



.



XHML-

XSL- XHTML- ( ). XHTML-, , .



.



XHML- , , :

( ). - , . / .

HTML-:

...









...







...







...







...








XSL-

XSL- :

<xsl:stylesheet version = '1.0' encoding="UTF-8"?>

<xsl:template match="element">



</xsl:template>

</xsl:stylesheet>








: <xsl:stylesheet version = '1.0' encoding="UTF-8"?>



- XML- . UTF-8 ( , ).

<xsl:stylesheet> </xsl:stylesheet>



- XSL-.

<xsl:template match="element"> </xsl:template>



- element.



:

<xsl:template match="element"></xsl:template>



- , element . element . <xsl:template match="element" mode="mode1"></xsl:template>



- , element mode1 . element . <xsl:template name="template-name"></xsl:template>



- template-name . - XML- .

XML- (, XML-, item ), " " :

<xsl:template match="navigation/sections/item"></xsl:template>





, , .., , , , .. navigation , navigation/sections/item sections/item .





, - . , xsl- . .



xsl .



, ( ) :

template_folder - . , my_template . dtd - . . lang - ( ). mod - .

xsl/my_template , layout.xsl :

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE xsl:stylesheet SYSTEM "../dtd/entities.dtd">

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



<xsl:template match="/node()">

</xsl:template>



</xsl:stylesheet>







:

<xsl:template match="/node()"> </xsl:template>



- /node() (). /node() //document , .. .



XHTML- <xsl:template match="/node()"></xsl:template>







XML- . , XSL- XML- XHTML- .



, XSL template.xsl (, template - ), :

<?xml version="1.0" encoding="UTF-8"?>

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



<xsl:import href=" my_template /layout.xsl"/>

</xsl:stylesheet>







:

<xsl:import href="my_template/layout.xsl"/>





XSL- ( XSL- ) . .





, .. XML- .



- .



, XML- :



<item id="0" parent_id="0" is_published="1" section="1">



/



<item id="1" parent_id="0" is_published="1" section="1" hit="yes">



news













:

id document - id . hit item - , , " ".

, , :

sections - . item - .

, , item item , , :













1. xsl/my_template navigation.xsl :

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE xsl:stylesheet SYSTEM "../dtd/entities.dtd">

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



<xsl:template match="sections" mode="global_menu">

</xsl:template>



</xsl:stylesheet>








2. layout.xsl :



<xsl:template match="sections" mode="global_menu">



</xsl:template>









3. тАж layout.xsl :



<xsl:apply-templates select="navigation/sections" mode="global_menu"/>









:

select="navigation/sections" - ( ) - . , navigation/sections .



mode="global_menu" - global_menu . , , , " ", - .



4. , layout.xsl navigation.xsl :

<xsl:import href="navigation.xsl"/>







5. , navigation.xsl , :



<xsl:template match="item" mode="global_menu">

<xsl:call-template name="href_attribute"/>

<xsl:value-of select="title"/>





</xsl:template>









:

<xsl:call-template name="href_attribute"/>



- . , .. .



<xsl:value-of select="title"/>



- - title . @ - .



6. sections :



<xsl:template match="sections" mode="global_menu">



</xsl:template>









:

<xsl:apply-templates select="item" mode="global_menu"/>



- item sections . , item item ( sections/item/item ) , .. .



item ( ) . , : <xsl:call-template name="href_attribute"/>







uri- . .



7. ,

, . item :



<xsl:template match="item" mode="global_menu">



<xsl:choose>



<xsl:when test="descendant-or-self::*/@id = /node()/@id">

<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:choose>

<xsl:when></xsl:when>

<xsl:otherwise></xsl:otherwise>

</xsl:choose>







тАж, , XML- . : <xsl:when test="descendant-or-self::*/@id = /node()/@id">







ID ( document ) ( item ), , .



<xsl:when></xsl:when>



, . <xsl:otherwise></xsl:otherwise>



- .



8. , href_attribute :



<xsl:template name="href_attribute">

<xsl:attribute name="href">

<xsl:text>/</xsl:text>

<xsl:for-each select="ancestor-or-self::item">

<xsl:value-of select="dir"/>

<xsl:text>/</xsl:text>

</xsl:for-each>

</xsl:attribute>

</xsl:template>









xsl:attribute . . a , , href , .. .



<xsl:for-each select="ancestor-or-self::item">



, . ancestor-or-self::item - . dir , .. -.



, - , . , .



UPD:

. , :

parser.proc.ru/iso/xslt-1.zip



( ) Apache.



XML- /xsl/document.xml



























All Articles