If I need to validate GUID value in transformation (for example API input validation rule) I need to construct something like this:
<xsl:template name="IsGuid">
<xsl:param name="value"/>
<xsl:choose>
<xsl:when
test="string-length($value) = 36
and substring($value,9,1) = '-'
and substring($value,14,1) = '-'
and substring($value,19,1) = '-'
and substring($value,24,1) = '-'
and translate(translate($value,'-',''),'0123456789abcdefABCDEF','') = ''">true</xsl:when>
<xsl:otherwise>false</xsl:otherwise>
</xsl:choose>
</xsl:template>
The template result needs to be stored into a variable and then validated in an extra step. Implementing a dedicated C# function for Guid validation would reduce the complexity of the transformations.