|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Building Dynamic Urls
Hmm, I thought he wants all the parameters. The correct logic that
generates all of them plus ? and ampersands correctly is something like:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:param name="url" select="'http://www.example.com/test'"/> <xsl:template match="/*"> <xsl:variable name="newURL"> <xsl:value-of select="$url"/> <xsl:apply-templates select="*[1]" mode="url"/> </xsl:variable> <xsl:value-of select="$newURL"/> </xsl:template> <xsl:template match="area|action|page" mode="url"> <xsl:param name="prefix" select="'?'"/> <xsl:value-of select="$prefix"/> <xsl:value-of select="name()"/> <xsl:text>=</xsl:text> <xsl:value-of select="."/> <xsl:apply-templates select="following-sibling::*[1]" mode="url"> <xsl:with-param name="prefix" select="'&'"/> </xsl:apply-templates> </xsl:template> </xsl:stylesheet> on
<?xml version="1.0" encoding="UTF-8"?>
<doc>
<area>1</area>
<action>2</action>
<page>3</page>
</doc>will give: http://www.example.com/test?area=1&action=2&page=3 Regards, George --------------------------------------------------------------------- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com Aron Bock wrote: > And in this case one would use <xsl:choose> rather than <xsl:if>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








