We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to test templates which yield attributes? i.e., <xsl:template select="src-element" mode="attr-group-1"> <xsl:attribute name="a">...</xsl:attribute> <xsl:attribute name="b">...</xsl:attribute> </xsl:template> <xsl:template select="src-element" mode="attr-group-2"> <xsl:attribute name="c">...</xsl:attribute> <xsl:attribute name="d">...</xsl:attribute> </xsl:template> <scenario> <context mode="attr-group-1"> <src-element ... /> </context> <expect> <!-- ??? specify expected attributes --> </expect> </scenario> Here's some backgrounds: I have many templates yield common set of attributes for different elements (from different source elements), i.e., <template match="S1" mode="T1"> <element name="T1"> <attribute name="common-a"><value-of select="@s1-a"></attribute> <attribute name="common-b"><value-of select="@s1-b"></attribute> <attribute name="t1">...</attribute> </element> </template> <template match="S1" mode="T2"> <element name="T2"> <attribute name="common-a"><value-of select="@s1-a"></attribute> <attribute name="common-b"><value-of select="@s1-b"></attribute> <attribute name="t2">...</attribute> </element> </template> <template match="S2" mode="T1"> <element name="T1"> <attribute name="common-a"><value-of select="@s2-a"></attribute> <attribute name="common-b"><value-of select="@s2-b"></attribute> <attribute name="t1">...</attribute> </element> </template> <template match="S1" mode="T2"> <element name="T2"> <attribute name="common-a"><value-of select="@s1-a"></attribute> <attribute name="common-b"><value-of select="@s1-b"></attribute> <attribute name="t2">...</attribute> </element> </template> <template match="S2" mode="T2"> <element name="T2"> <attribute name="common-a"><value-of select="@s2-a"></attribute> <attribute name="common-b"><value-of select="@s2-b"></attribute> <attribute name="t2">...</attribute> </element> </template> There are so many duplications, so I want to refactor these templates as like following: <!-- common attributes --> <template match="S1" mode="common-attrs"> <attribute name="common-a"><value-of select="@s1-a"></attribute> <attribute name="common-b"><value-of select="@s1-b"></attribute> </template> <template match="S2" mode="common-attrs"> <attribute name="common-a"><value-of select="@s2-a"></attribute> <attribute name="common-b"><value-of select="@s2-b"></attribute> </template> <!-- each transforms of {S1,S2} x {T1, T2} --> <template match="S1" mode="T1"> <element name="T1"> <apply-templates select="." mode="common-attrs" /> <attribute name="t1">...</attribute> </element> </template> <template match="S1" mode="T2"> <element name="T2"> <apply-templates select="." mode="common-attrs" /> <attribute name="t2">...</attribute> </element> </template> <template match="S2" mode="T1"> <element name="T1"> <apply-templates select="." mode="common-attrs" /> <attribute name="t1">...</attribute> </element> </template> <template match="S2" mode="T2"> <element name="T2"> <apply-templates select="." mode="common-attrs" /> <attribute name="t2">...</attribute> </element> </template> So it would be great there is some ways to test the "common-attrs" templates.
Original issue reported on code.google.com by [email protected] on 15 Sep 2012 at 8:11
[email protected]
The text was updated successfully, but these errors were encountered:
Oops, the template S1->T2 (the one before the refactoring) is duplicated. Sorry for the mess.
Original comment by [email protected] on 15 Sep 2012 at 8:14
Sorry, something went wrong.
add bats test issue expath#46 / pr expath#48 (expath#51)
ba5f97c
No branches or pull requests
Original issue reported on code.google.com by
[email protected]
on 15 Sep 2012 at 8:11The text was updated successfully, but these errors were encountered: