Created
June 3, 2011 01:28
-
-
Save richardlehane/1005694 to your computer and use it in GitHub Desktop.
This XSL stylesheet demonstrates how a batch file can be generated to automatically create directory structures that correspond to the terms (functions and activities) of an XML authority.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- This XSL stylesheet demonstrates how a batch file can be generated to automatically create directory structures that correspond to the terms (functions and activities) of an XML authority. --> | |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rda="http://www.records.nsw.gov.au/schemas/RDA" version="1.0" > | |
<xsl:output method="text" encoding="UTF-8"/> | |
<xsl:include href="include/utils.xsl"/> | |
<xsl:template match="/"> | |
<xsl:apply-templates select="//rda:Term"/> | |
</xsl:template> | |
<xsl:template match="rda:Term"> | |
<!-- the "%~dp0" creates the new directories in the directory where the batch file sits. | |
If running the batch file over a network, using a user's current working directory might be more appropriate. | |
To do this, change line to: <xsl:text>mkdir "%cd%\</xsl:text>--> | |
<xsl:text>mkdir "%~dp0\</xsl:text> | |
<!-- use the "build_address" template in the "utils.xsl" stylesheet bundled with XML Authority Editor. | |
This template is used in many AE stylesheets to create breadcrumb-style names i.e. "Function Title - Activity title". | |
We use it here to build a directory structure i.e. "Function Title\Activity Title".--> | |
<xsl:call-template name="build_address"> | |
<xsl:with-param name="node" select="."/> | |
<xsl:with-param name="sep" select="'\'"/> | |
</xsl:call-template> | |
<xsl:text>"
</xsl:text> | |
</xsl:template> | |
</xsl:stylesheet> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment