File: Data.xml
<?xml version="1.0" encoding="utf-8"?>
<data>
<value>3aacc</value>
<value>9-12-45</value>
<value>Q6-88</value>
</data>
File: Transform.xslt
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:apply-templates select="//value"/>
</xsl:template>
<xsl:template match="value">
<Paragraph>
<xsl:value-of select="."/>
<xsl:if test="starts-with(translate(., '0123456789', '9999999999'), '9')">
<xsl:text> (the text starts with a number)</xsl:text>
</xsl:if>
</Paragraph>
</xsl:template>
</xsl:stylesheet>
Output:
<?xml version="1.0" encoding="UTF-8"?><Paragraph>3aacc (the text starts with a number)</Paragraph><Paragraph>9-12-45 (the text starts with a number)</Paragraph><Paragraph>Q6-88</Paragraph>
|