[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Tokenizing IDREFs
Hi Stuart, > However, this clearly only functions where the IDREFs are delimited > by a single space. I am trying to construct a transformation which > will work if the IDREFs are delimited by EITHER a single space OR a > line-break, but to absolutely no success. Any pointers, please? The easiest thing is to normalize the whitespace in the string before you pass it to your tokenize template - this will strip leading and trailing whitespace and convert any consecutive whitespace characters (including line breaks) into single spaces. And it has the advantage of being a fairly simple change to your existing template: <xsl:template match="inTag"> <xsl:variable name="value" select="normalize-space(@value)" /> <xsl:choose> <xsl:when test="contains($value,' ')"> <bag> <xsl:call-template name="tokenize"> <xsl:with-param name="string" select="$value" /> </xsl:call-template> </bag> </xsl:when> <xsl:otherwise> <outTag value="{$value}"/> </xsl:otherwise> </xsl:choose> </xsl:template> [Note that for simplicity I've used the select attribute of xsl:with-param rather than its content, so that it's set to a string rather than a result tree fragment, since that's all you need. I'd suggest making the same change in your tokenize template.] I hope that helps, Jeni --- Jeni Tennison http://www.jenitennison.com/ 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
|