I've the below 2 different XML Cases.
Case1
<para><content-style font-style="bold">1/3</content-style> This is text</para>
Case2
<para>This is text <content-style font-style="bold">1/3</content-style></para>
i'm using the template match as below
<xsl:template match="para[content-style[matches(., '(\w+)/(\w+)')]]">
but as per this match, both the cases mentioned above are satisfied, i want only first case to be caught ignoring the second case.
please let me know how can i get this done.
Thanks
There is no need to use
matches()
. If the rule is whether thecontent-style
element is the first child node ofpara
, match forAssuming the following input document, where both cases are present:
XML Input
XSLT Stylesheet
XML Output