Stylesheet: /build/tests/stubs/link-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:param name="targetdir"/> 10: <xsl:function name="zenta:makeUrlFromSource"> 11: <xsl:param name="source"/> 12: <xsl:choose> 13: <xsl:when test="$source='tests/providing'"> 14: <xsl:value-of select="resolve-uri('../testdata/providing')"/> 15: </xsl:when> 16: <xsl:when test="$source='tests/providing2'"> 17: <xsl:value-of select="resolve-uri('../testdata/providing2')"/> 18: </xsl:when> 19: <xsl:when test="$source='tests/dependent'"> 20: <xsl:value-of select="resolve-uri('../testdata/dependent')"/> 21: </xsl:when> 22: <xsl:otherwise><xsl:message terminate = "yes" select="concat('no rule for ', $source)"/></xsl:otherwise> 23: </xsl:choose> 24: </xsl:function> 25: 26: </xsl:stylesheet> 27:
01: <?xml version="1.0" encoding="UTF-8"?> 02: <xsl:stylesheet 03: xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 04: version='2.0' 05: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 06: xmlns:zenta="http://magwas.rulez.org/zenta"> 07: 08: <xsl:function name="zenta:normalizeFilename"> 09: <xsl:param name="name"/> 10: <xsl:value-of select="substring( 11: replace( 12: replace($name,'[/\^\?\[\]\(\)]','_'), 13: '\s+$', 14: '' 15: ), 16: 1,150)"/> 17: </xsl:function> 18: </xsl:stylesheet> 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: 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:
001: <?xml version="1.0" encoding="UTF-8"?> 002: <xsl:stylesheet 003: xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 004: version='2.0' 005: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 006: xmlns:zenta="http://magwas.rulez.org/zenta"> 007: 008: 009: <xsl:template match="property" mode="importOne"> 010: <xsl:param name="imported" tunnel="yes" select="@name"/> 011: <xsl:param name="level" tunnel="yes" select="1"/> 012: <xsl:message> 013: <xsl:value-of select="concat($level,' importing ',@value, ' imported:', string-join($imported//@value,' '))"/> 014: </xsl:message> 015: <folder> 016: <xsl:attribute name="name" select="@value"/> 017: <xsl:attribute name="id" select="generate-id()"/> 018: <property key="source" value="{@value}"/> 019: <xsl:variable name="file" select="zenta:makeUrlFromSource(@value)"/> 020: <xsl:variable name="index" select="document(concat($file,'/index'))"/> 021: <xsl:variable name="content"> 022: <xsl:apply-templates select="$index/index/*" mode="load"> 023: <xsl:with-param tunnel="yes" name="inputdir" select="$file"/> 024: </xsl:apply-templates> 025: </xsl:variable> 026: <xsl:apply-templates select="$content" mode="link"> 027: <xsl:with-param name="source" select="@value"/> 028: <xsl:with-param name="imported" select="$imported" tunnel="yes"/> 029: <xsl:with-param name="level" select="$level+1" tunnel="yes"/> 030: </xsl:apply-templates> 031: </folder> 032: </xsl:template> 033: 034: <xsl:template match="/" mode="test"> 035: <xsl:variable name="dir" select="'modelparts/smarthomecare/analysis'"/> 036: <xsl:variable name="index" select="document(concat($dir,'/index'))"/> 037: <xsl:apply-templates select="$index/index/*" mode="load"> 038: <xsl:with-param tunnel="yes" name="inputdir" select="$dir"/> 039: </xsl:apply-templates> 040: </xsl:template> 041: 042: <xsl:template match="entry" mode="load"> 043: <xsl:param name="inputdir" tunnel="yes"/> 044: <xsl:copy-of select="document(concat($inputdir,'/',@id,'_',zenta:normalizeFilename(@name)))"/> 045: </xsl:template> 046: 047: <xsl:template match="folder" mode="load"> 048: <xsl:param name="inputdir" tunnel="yes"/> 049: <xsl:variable name="folderdir" select="concat($inputdir,'/',zenta:normalizeFilename(@name))"/> 050: <xsl:variable name="folder" select="document(concat($inputdir,'/',@id,'-',zenta:normalizeFilename(@name)))"/> 051: <xsl:variable name="index" select="document(concat($folderdir,'/index'))"/> 052: <xsl:variable name="out"> 053: <folder> 054: <xsl:copy-of select="$folder/folder/@*|$folder/folder/*"/> 055: <xsl:apply-templates select="$index/index/*" mode="load"> 056: <xsl:with-param tunnel="yes" name="inputdir" select="$folderdir"/> 057: </xsl:apply-templates> 058: </folder> 059: </xsl:variable> 060: <xsl:copy-of select="$out"/> 061: </xsl:template> 062: 063: <xsl:template match="foo" mode="import" /> 064: 065: <xsl:template match="*[property/@key='modelDependency']" mode="import"> 066: <xsl:param name="imported" tunnel="yes" select="@id"/> 067: <xsl:variable name="props" select="property[@key='modelDependency' and not(@value = $imported//@value)]"/> 068: <xsl:variable name="firstProp" select="$props[1]"/> 069: <xsl:variable name="otherProps"> 070: <foo> 071: <xsl:copy-of select="$props[position()>1]"/> 072: </foo> 073: </xsl:variable> 074: <xsl:variable name="dep"> 075: <xsl:apply-templates select="$firstProp" mode="importOne"> 076: <xsl:with-param name="imported" select="$imported" tunnel="yes"/> 077: </xsl:apply-templates> 078: </xsl:variable> 079: 080: 081: <xsl:copy-of select="$dep"/> 082: <xsl:variable name="depImports" select="$dep//property[@key='modelDependency']"/> 083: <xsl:variable name="providedIds" select="tokenize(string-join($dep//@id|.//@id,' '),' ')"/> 084: <xsl:variable name="provideds"> 085: <provideds> 086: <xsl:attribute name="provideds" select="$providedIds"/> 087: </provideds> 088: </xsl:variable> 089: <xsl:apply-templates select="$otherProps" mode="import"> 090: <xsl:with-param name="imported" select="$imported|$depImports,$provideds" tunnel="yes"/> 091: </xsl:apply-templates> 092: </xsl:template> 093: 094: <xsl:template match="*[property/@key='modelDependency']" mode="link"> 095: <xsl:param name="imported" tunnel="yes" select="@id"/> 096: <xsl:variable name="deps"> 097: <xsl:apply-templates select="." mode="import"/> 098: </xsl:variable> 099: <xsl:variable name="providedIds" select="tokenize(string-join($imported//@provideds|$deps//@id|.//@id,' '),' ')"/> 100: <xsl:variable name="requiredIds" select="tokenize(string-join(.//(@source|@target|@relationship|@zentaElement|@ancestor),' '),' ')"/> 101: <xsl:variable name="notProvided" select="for $required in $requiredIds return if($required = $providedIds) then () else $required"/> 102: <xsl:if test="count($notProvided) != 0"> 103: <xsl:value-of select="error( 104: QName('http://magwas.rulez.org/zenta','zenta:missingIds'), 105: concat( 106: 'No dependency is provided in ', 107: @name, 108: ' for the following ids: ', 109: string-join($notProvided,' ')))"/> 110: </xsl:if> 111: <xsl:variable name="provideds"> 112: <provideds> 113: <xsl:attribute name="provideds" select="$providedIds"/> 114: </provideds> 115: </xsl:variable> 116: <xsl:copy> 117: <xsl:apply-templates select="*|@*|text()" mode="link"> 118: <xsl:with-param name="imported" select="$imported,$deps//property[@key='source'],$provideds" tunnel="yes"/> 119: </xsl:apply-templates> 120: <xsl:copy-of select="$deps" /> 121: </xsl:copy> 122: </xsl:template> 123: 124: </xsl:stylesheet> 125: