删除《沉默的证人XII》中的敌友地雷

删除《沉默的证人XII》中的敌友地雷

移除 Silent Witness XII 中极为密集的友军/敌军地雷,使用可轻松适配其他用途的 XSLT。

银河

以下是用来生成这个模组的非常简单的 XSLT。稍作调整,可以完成更多操作。我注释掉了游戏开始(gamestart)的生成代码,大部分精彩内容都在那里:

[code] <xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes" /> <xsl:strip-space elements="*" />

<xsl:param name="inF" select="inF"/>
<xsl:param name="modID" select="modID"/>
<xsl:param name="outF" select="outF"/>
<!-- root 应以 / 结尾 -->
<xsl:param name="root" select="root"/>
<xsl:param name="universe" select="universe"/>
<xsl:variable name="otherExtensionFolder" select="replace($root,'^[^/]*/','')"/>

<xsl:param name="region" select="region"/>

<xsl:variable name="sourceString" select="concat($inF,$root)"/>
<xsl:variable name="outputString" select="concat($outF,$modID,'/')"/>
<xsl:variable name="sourceURI" select="concat('file:///',encode-for-uri(replace($sourceString,'\\','/')))"/>
<xsl:variable name="outputURI" select="concat('file:///',encode-for-uri(replace($outputString,'\\','/')))"/>

<xsl:template name="main">
    <xsl:variable name="clusters">
        <xsl:choose>
            <xsl:when test="starts-with($universe,'demo')">
                <xsl:value-of select="concat('demo_','clusters')"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="concat(replace(replace($root,'^[^/]*/',''),'^[^/]*/ego_(.*)/','$1_'),'clusters')"/>    
            </xsl:otherwise>
        </xsl:choose>
    </xsl:variable>
    
    <xsl:result-document href="{concat($outputURI,'content.xml')}">
        <content id="{$modID}" 
                 name="{$modID}" description="" author="{concat('metame','''','s Generator')}" 
                 date="{format-date(current-date(),'[Y0001]-[M01]-[D01]')}" 
                 version="100" save="0">
        </content>
    </xsl:result-document>
    
    <xsl:result-document href="{concat($outputURI,'libraries/region_definitions.xml')}">
        <diff>
            <remove sel="/regions/region[@name='{$region}']/fields/object[@ref='weapon_gen_mine_03_macro']" />
        </diff>
    </xsl:result-document>
</xsl:template>

</xsl:stylesheet> [/code]