Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [xsl] Dynamiczne xsl:include
webdice
post 10.01.2008, 02:53:02
Post #1


Developer


Grupa: Moderatorzy
Postów: 3 045
Pomógł: 290
Dołączył: 20.01.2007




Witam,

Czy można stworzyć dynamiczne xsl:include? Chodzi mi o coś w stylu:

Kod
<xsl:variable name="filePath">
  index2.xsl
</xsl:variable>
    
<xsl:include href="{$filePath}" />


i inne tego typu rozwiązania (to oczywiście nie działa). Próbowałem również z wstawianiem lub podmianą xsl:include w PHP, co do wstawiania wstawiał mi na końcu dokumentu co oczywiście jest niepoprawne. Z insertBefore oraz replaceChild nie bardzo mi wychodziło.

Czy jest jakieś rozwiązanie tego problemu? Najbardziej zadowoliło by mnie to w XSL, a nie PHP, ale w ostateczności... smile.gif.

EDIT: Problem rozwiązałem w PHP w taki sposób:

  1. <?php
  2. $XSL -> getElementsByTagName ('include') -> item(0) -> setAttribute ('href', $filePath);
  3. ?>


Jakby ktoś miał rozwiązanie oparte o sam dokument XSL to prosiłbym o podanie. Z tego co czytałem to raczej tego zrobić nie da, ale kto wie.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
Cezar708
post 10.01.2008, 09:55:52
Post #2





Grupa: Zarejestrowani
Postów: 1 116
Pomógł: 119
Dołączył: 10.05.2005
Skąd: Poznań

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


Cytat
Note: <xsl:include href="URI"/> element must appear as a child node of <xsl:stylesheet> or <xsl:transform>.

(źródło)

Być może to nie jest dziecko <xsl:stylesheet> lub <xsl:transform>?
Go to the top of the page
+Quote Post
webdice
post 10.01.2008, 15:41:41
Post #3


Developer


Grupa: Moderatorzy
Postów: 3 045
Pomógł: 290
Dołączył: 20.01.2007




  1. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  2.      <xsl:output method="xml" encoding="ISO-8859-2" indent="no" />
  3.  
  4.      <xsl:include href="contact.xsl" />
  5.  
  6.      <xsl:template match="/">
  7.            <!-- content -->
  8.      </xsl:template>
  9.  
  10. </xsl:stylesheet>


Czyli jest, czytałem to, jeśli by tak nie musiało być sprawa była by prosta. Czytałem również (na jakimś forum) że tego zrobić się nie da.
Go to the top of the page
+Quote Post

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

 



RSS Wersja Lo-Fi Aktualny czas: 19.07.2025 - 09:54