Project

Profile

Help

type-of() ?

Added by Anonymous about 14 years ago

Legacy ID: #8069611 Legacy Poster: Bruno Feurer (bfeurer)

Hi How can I detect the type of an item? eg. to define a function with a parameter to take a string or a node: <xsl:param name="item"/> xsl:choose <xsl:when test="[i]type-of/i = node()"> <xsl:apply-templates select="$item"/> </xsl:when> xsl:otherwise <xsl:value-of select="$item"/> </xsl:otherwise> </xsl:choose> Thanks, Bruno


Replies (2)

RE: type-of() ? - Added by Anonymous about 14 years ago

Legacy ID: #8069777 Legacy Poster: Michael Kay (mhkay)

Use the "instance of" operator: for example if ($item instance of node()) then ...

RE: type-of() ? - Added by Anonymous about 14 years ago

Legacy ID: #8069875 Legacy Poster: Bruno Feurer (bfeurer)

Thank you! I was looking for something suitable in the wrong specification ("XQuery 1.0 and XPath 2.0 Functions and Operators"). Sorry for not widening my search before asking. Bruno

    (1-2/2)

    Please register to reply