]> git.donarmstrong.com Git - qmk_firmware.git/blob - tmk_core/protocol/lufa/LUFA-git/LUFA/StudioIntegration/XDK/lufa_extension_transform.xslt
Merge commit 'f6d56675f9f981c5464f0ca7a1fbb0162154e8c5'
[qmk_firmware.git] / tmk_core / protocol / lufa / LUFA-git / LUFA / StudioIntegration / XDK / lufa_extension_transform.xslt
1 <!--
2              LUFA Library
3      Copyright (C) Dean Camera, 2013.
4
5   dean [at] fourwalledcubicle [dot] com
6            www.lufa-lib.org
7 -->
8
9 <!-- Atmel Studio framework Extension XML transform file -->
10
11 <!-- Creates an extension.xml document from a given manifest list of XML files,
12      and adds appropriate documentation base URI entries and version
13      information. -->
14 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
15         <xsl:output method="xml" omit-xml-declaration="yes"/>
16
17         <!-- Store the LUFA version mentioned in the root node for later use -->
18         <xsl:param name="lufa-version" select="lufa-manifest/@version"/>
19
20         <!-- Read manifest list and then process all FDK nodes in the referenced
21              document -->
22         <xsl:template match="lufa-manifest">
23                 <xsl:comment>This file has been automatically generated from the LUFA Atmel Studio integration XML files.</xsl:comment>
24
25                 <extension-container xmlversion="2.0">
26                         <xsl:for-each select="xml-source">
27                                 <xsl:apply-templates select="document(@filename)/lufa/extension-container/*"/>
28                         </xsl:for-each>
29                 </extension-container>
30         </xsl:template>
31
32         <!-- Recursively match and copy/process all nodes/attributes -->
33         <xsl:template match="@*|node()">
34                 <xsl:copy>
35                         <xsl:apply-templates select="@*|node()"/>
36                 </xsl:copy>
37         </xsl:template>
38
39         <!-- Update the extension version to the version of LUFA being used -->
40         <xsl:template match="extension/@version">
41                 <xsl:attribute name="version">
42                         <xsl:value-of select="substring($lufa-version, 1, 2)"/>
43                         <xsl:text>.</xsl:text>
44                         <xsl:value-of select="substring($lufa-version, 3, 2)"/>
45                         <xsl:text>.</xsl:text>
46                         <xsl:value-of select="substring($lufa-version, 5, 2)"/>
47                 </xsl:attribute>
48         </xsl:template>
49
50         <!-- Update the extension online help URLs to the version of LUFA being
51              used -->
52         <xsl:template match="online-help/*/@baseurl">
53                 <xsl:attribute name="baseurl">
54                         <xsl:value-of select="current()"/>
55                         <xsl:value-of select="$lufa-version"/>
56                         <xsl:text>/html/</xsl:text>
57                 </xsl:attribute>
58         </xsl:template>
59
60         <xsl:template match="online-help/index-page/@url">
61                 <xsl:attribute name="url">
62                         <xsl:value-of select="current()"/>
63                         <xsl:value-of select="$lufa-version"/>
64                         <xsl:text>/html/</xsl:text>
65                 </xsl:attribute>
66         </xsl:template>
67
68 </xsl:stylesheet>