xsl-list
[Top] [All Lists]

[xsl] Retrieving values

2009-01-08 09:43:14
Hello,

I have 2 beginner questions:

QUESTION 1:

Assume:


<books>
        <book><code>1</code><title>TitleA</title></book>
</books>

And:

<xsl:template match="books">
 <xsl:for-each-group select="book" group-by="code">
 <xsl:message select="current-grouping-key()"/>
 <xsl:message select="current-group()/title"/>
<xsl:message select="count(current-group()/title)"/>
 </xsl:for-each-group>
</xsl:template>

Output:

1
<title>TitleA</title>
1

Question: How to get a Sequence of values  so ('TitleA',......)?

I modified the selection to the following but this doesn't work:

 <xsl:message select="current-group()/@title"/>
<xsl:message select="count(current-group()/@title)"/>
Output

1
<empty>
0

QUESTION 2:

How to run a XPath selection on a Sequence. E.g.:

 <xsl:variable name="titles" select="('titleA','titleB')"/>
 <xsl:variable name="selectedBooks" select="/books/book[(_at_)title
ISINSEQUENCE $titles]"/>

Is this possible to check a attribute does exist in a sequence?

Thanks Peter

--~------------------------------------------------------------------
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>