XSLT Rules that brake and symbols that change meaning -
these observations born out of frustration while learning xslt.
meaning of symbols changes depending on position , context
following 3 lines show usage of '/' character , in each line character symbolizes different. in first line represents root node, in second child-parent relationship , in third descendants of people element. in other words meaning of same character has been overridden 3 times , changes meaning depending on position , surrounding context.
<xsl:template match="/"> <xsl:template match="people/person"> <xsl:template match="people//name">
rules brake when combined
in following expression '/' means root node.
<xsl:template match="/">
.
in following expression '/' means person child of people.
<xsl:template match="people/person">
.
now if try combine these 2 rules reference people should child of root node write <xsl:template match="//people">
, expected result accident.
that because '//' has new meaning has nothing root node or child parent relationship. means descendants , in context refers descendant of root node , not people child.
it makes me wonder
with these problems plaguing xslt makes me wonder people created it, did try achieve, guidelines , indented users. sure these people extremely smart since xslt extremely complicated. wonder if creating monster them selves either deliberately making unnecessary complex , confusing in order erect artificial barrier against else or if couldn't care less others might want use long thing seems usable them.
Comments
Post a Comment