|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: xslt replace special characters
Alice,
It sounds like your user interface is one where the user types in an URL string. You could offer additional fields if they need to enter multiple name/value pairs (the only reason for an ampersand to appear in an URL). Then your xsl could construct the final URL, adding the '?' if any name/value pairs exist, and then outputting them with your own '&' and '=' characters placed between them. Sample XML (constructed from text fields):
<userURL>
<baseURL>http://www.someplace.com/dir/page.htm</baseURL>
<pair>
<name>arg1</name>
<value>value1</value>
</pair>
<pair>
<name>arg2</name>
<value>value2</value>
</pair>
<pair>
<name>arg3</name>
<value>value3</value>
</pair>
</userURL>Relevant XSL:
<xsl:template match="userURL">
<xsl:value-of select="baseURL"/>
<xsl:apply-templates select="pair"/>
</xsl:template>
<xsl:template match="pair">
<xsl:if test="position() = 1">
<xsl:text>?</xsl:text>
</xsl:if>
<xsl:value-of select="name" />
<xsl:text>=</xsl:text>
<xsl:value-of select="value" />
<xsl:if test="position() != last()">
<xsl:text>&</xsl:text>
</xsl:if>
</xsl:template>Greg At 08:20 PM 11/10/2002, you wrote: so the user has to input & or &3038; if their url consisys of an '&'. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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








