Last active
March 13, 2020 18:49
-
-
Save jetzerb/cb79140610e3653ed93e9fe09c32beb0 to your computer and use it in GitHub Desktop.
XSLT to dump out the list of hosts from your mRemoteNG config file
This file contains hidden or 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"?> | |
<xsl:stylesheet version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
> | |
<xsl:output method="text" omit-xml-declaration="yes" /> | |
<xsl:variable name="pad" select="' '" /> | |
<!-- override the default template that prints all text --> | |
<xsl:template match="text()|@*" /> | |
<!-- Output indented list of nodes along with hostnames --> | |
<xsl:template match="//Node" > | |
<xsl:value-of select="concat( | |
substring($pad,1,2*(count(ancestor::*)-1)) | |
,@Name)" /> | |
<xsl:if test="@Hostname != '' and @Name != @Hostname" > | |
<xsl:value-of select="concat( | |
substring($pad,1,30 - string-length(@Name)) | |
,' - ' | |
,@Hostname)" /> | |
</xsl:if> | |
<xsl:text>
</xsl:text> | |
<xsl:apply-templates /> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Call it like this:
The output looks like this: