xsl-list
[Top] [All Lists]

Re: [xsl] sequence of strings

2008-12-02 09:20:30
Michael Kay wrote:

I would tend to write that as

<xsl:function name="get-attributes" as="xs:string*">
  <xsl:param name="string" as="xs:string"/>
  <xsl:sequence select="'BLD'[contains($string, 'bold')],
'ITA'[contains($string, 'italic')]"/>
</xsl:function>

Thank you for your answer. This I was looking for all the time: a way to create a sequence of string in the select of xsl:sequence. However, I don't understand completely what is going on in that select. I have your programmers reference. If you could tell me what section I should read to understand it, I would be grateful...


or if it were a longer list of names then

<xsl:variable name="styles" as="element(style)">
  <style name="BLD" code="bold"/>
  <style name="ITA" code="italic"/>
</xsl:variable>

<xsl:function name="get-attributes" as="xs:string*">
  <xsl:param name="string" as="xs:string"/>
  <xsl:sequence select="$styles[contains($string, @code)]/@name"/>
</xsl:function>

I am going to use this one. Obviously the two missing links were the xsl:function element and the xsl:sequence use. I suspect I only use a subset of the xslt2 features...

Thanks for helping!

regards, Ruud


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>