Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [xml][xsl] Menu,submenu
kumar
post
Post #1





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 11.01.2010

Ostrzeżenie: (0%)
-----


Witam.

Mam pytanie jak dodac do tego:

  1. <?xml version="1.0"?>
  2.  
  3. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="/schemas/stylesheet.xsd">
  4. <xsl:output
  5. method="xml"
  6. indent="no"
  7. encoding="utf-8" />
  8. <!-- Template for the menu -->
  9. <xsl:template match="menu">
  10. <xsl:param name="querystring"/>
  11. <ul>
  12. <xsl:if test="name(..) != 'item'">
  13. <xsl:attribute name="class">menu</xsl:attribute>
  14. </xsl:if>
  15. <xsl:apply-templates select="item">
  16. <xsl:with-param name="querystring" select="$querystring"/>
  17. </xsl:apply-templates>
  18. </ul>
  19. </xsl:template>
  20. <!-- Template for the menu items -->
  21. <xsl:template match="item">
  22. <xsl:param name="querystring"/>
  23. <li>
  24. <a href="{link}{$querystring}">
  25. <xsl:value-of select="mxf:locale(text)"/>
  26. </a>
  27. <xsl:apply-templates select="menu">
  28. <xsl:with-param name="querystring" select="$querystring"/>
  29. </xsl:apply-templates>
  30. </li>
  31. </xsl:template>
  32. </xsl:stylesheet>


Submenu ?

plik xml wyglada tak :

  1. <?xml version="1.0"?>
  2.  
  3. <menu xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="/schemas/menu.xsd">
  4. <item>
  5. <text lang="en">galeria</text>
  6. <link>/admin/galeria</link>
  7. </item>
  8.  
  9. <item>
  10. <text lang="en">Wyloguj</text>
  11. <link>/admin/logout</link>
  12. </item>
  13. </menu>


Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 10.06.2026 - 13:11