Stylesheet: /build/tests/stubs/constraints-wired.xslt
not used
01: <?xml version="1.0" encoding="ISO-8859-1"?> 02: <xsl:stylesheet version="2.0" 03: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 04: xmlns:archimate="http://www.archimatetool.com/archimate" 05: xmlns:zenta="http://magwas.rulez.org/zenta" 06: xmlns:saxon="http://saxon.sf.net/" 07: xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 08: 09: <xsl:function name="zenta:getAncestry"> 10: <xsl:param name="element"/> 11: <xsl:param name="doc"/> 12: <xsl:choose> 13: <xsl:when test="$element/@id='element'"> 14: <xsl:variable name="ret" select="$doc//element[@id=('grandparent','parent','element')]"/> 15: <xsl:copy-of select="$ret"/> 16: </xsl:when> 17: <xsl:when test="$element/@id='auntie'"> 18: <xsl:variable name="ret" select="$doc//element[@id=('grandparent','auntie')]"/> 19: <xsl:copy-of select="$ret"/> 20: </xsl:when> 21: 22: <xsl:otherwise><xsl:message terminate = "yes"> 23: getAncestry: no rule for <xsl:copy-of select="$element"/> 24: </xsl:message></xsl:otherwise> 25: </xsl:choose> 26: </xsl:function> 27: 28: </xsl:stylesheet> 29:
01: <?xml version="1.0" encoding="ISO-8859-1"?> 02: <xsl:stylesheet version="2.0" 03: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 04: xmlns:archimate="http://www.archimatetool.com/archimate" 05: xmlns:zenta="http://magwas.rulez.org/zenta" 06: xmlns:saxon="http://saxon.sf.net/" 07: xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 08: 09: <xsl:function name="zenta:neighbours"> 10: <xsl:param name="doc"/> 11: <xsl:param name="element"/> 12: <xsl:param name="path"/> 13: <xsl:choose> 14: <xsl:when test="$element/@id='parent' and $path='constrains,2'"> 15: <xsl:variable name="ret" select="$doc//element[@id='parent_constraint']"/> 16: <xsl:copy-of select="$ret"/> 17: </xsl:when> 18: <xsl:when test="$element/@id='grandparent' and $path='constrains,2'"> 19: <xsl:variable name="ret" select="$doc//element[@id='grandparent_constraint']"/> 20: <xsl:copy-of select="$ret"/> 21: </xsl:when> 22: 23: <xsl:otherwise><xsl:message terminate = "yes"> 24: neighbours: no rule for <xsl:copy-of select="$element"/> and <xsl:copy-of select="$path"/> 25: </xsl:message></xsl:otherwise> 26: </xsl:choose> 27: </xsl:function> 28: 29: </xsl:stylesheet> 30:
01: <?xml version="1.0" encoding="ISO-8859-1"?> 02: <xsl:stylesheet version="2.0" 03: xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 04: 05: <xsl:template match="@*|*|processing-instruction()|comment()" mode="#all"> 06: <xsl:copy> 07: <xsl:apply-templates select="*|@*|text()|processing-instruction()|comment()" mode="#current"/> 08: </xsl:copy> 09: </xsl:template> 10: 11: <xsl:template match="element" mode="changeElementType"> 12: <elementCopy> 13: <xsl:apply-templates select="*|@*|text()|processing-instruction()|comment()" mode="#current"/> 14: </elementCopy> 15: </xsl:template> 16: 17: </xsl:stylesheet> 18: 19:
01: <?xml version="1.0" encoding="ISO-8859-1"?> 02: <xsl:stylesheet version="2.0" 03: xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 04: xmlns:zenta="http://magwas.rulez.org/zenta" 05: xmlns:zentatools="http://magwas.rulez.org/zentatools" 06: xmlns:saxon="http://saxon.sf.net/" 07: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 08: 09: <xsl:function name="zenta:findConstraints"> 10: <xsl:param name="doc"/> 11: <xsl:param name="element"/> 12: <xsl:variable name="ancestry" select="zenta:getAncestry($element,$doc)[position() < last()]"/> 13: <xsl:for-each select="$ancestry"> 14: <xsl:for-each select="zenta:neighbours($doc,.,'constrains,2')"> 15: <constraint> 16: <xsl:copy-of select="@name|@id"/> 17: <xsl:attribute name="stages" select="tokenize(documentation,'\|')[1]"/> 18: <xsl:attribute name="xpath" select="string-join(tokenize(documentation,'\|')[position() > 1], '|')"/> 19: </constraint> 20: </xsl:for-each> 21: </xsl:for-each> 22: </xsl:function> 23: 24: <xsl:function name="zenta:checkConstraints"> 25: <xsl:param name="doc"/> 26: <xsl:param name="element"/> 27: <xsl:if test="$element/@template = 'false'"> 28: <xsl:for-each select="zenta:findConstraints($doc,$element)"> 29: <xsl:variable name="xpathResult" select="zentatools:evaluate(@xpath)"/> 30: <xsl:if test="count($xpathResult) != 0"> 31: <error type="constraintError" element="{$element/@id}"> 32: <xsl:attribute name="errorID" select="replace(concat('constraintError__',$element/@id,'_',@name),' ','_')"/> 33: <xsl:attribute name="constraintName" select="@name"/> 34: <xsl:attribute name="constraintXPath" select="@xpath"/> 35: <xsl:attribute name="constraintobject" select="@id"/> 36: <details><xsl:apply-templates mode="changeElementType" select="$xpathResult"/></details> 37: <xsl:for-each select="tokenize(@stages,',')"> 38: <stage value="{.}"/> 39: </xsl:for-each> 40: </error> 41: </xsl:if> 42: </xsl:for-each> 43: </xsl:if> 44: </xsl:function> 45: 46: 47: </xsl:stylesheet> 48: