witam, chcę za pomocą XLST przerobić dokument XML,XML:
<portale> <portal> <name>portal Onet</val1> <link>http://www.onet.pl</link> </portal> <portal> <name>portal Wp.PL</val1> <link>http://www.wp.pl</link> </portal></portale>
XSLT:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <h2>Portale</h2> <xsl:for-each select="./portale/portal"> <a href="{tu jest problem}"><xsl:value-of select="name" /></a> <hr /> </xsl:for-each> </xsl:template></xsl:stylesheet>
w jaki sposób musi być zbudowany dokument XSLT (lub nawet ten XML) aby w wyniku dało mi wynik:
<h2>Portale
</h2><a href="http://www.onet.pl">Portal Onet
</a><hr /><a href="http://www.wp.pl">Portal Wp.PL
</a><hr />
czyli innymi słowy: jak wrzucić link do środka tagu <a> w XLST, czy jest to w ogóle możliwe?Pozdrawiamdobra znalazłem, proszę o zamknięcie i ewentualne usunięcie wątku, przepraszam za zamieszanierozwiązanie to zmiana w pliku XSLT:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <h2>Portale</h2> <xsl:for-each select="./portale/portal"> <a> <!-- poniżej linia z rowiązaniem --> <xsl:attribute name="href"><xsl:value-of select="link" /></xsl:attribute> <xsl:value-of select="name" /> </a> <hr /> </xsl:for-each> </xsl:template></xsl:stylesheet>