Showing posts with label Others. Show all posts
Showing posts with label Others. Show all posts

Wednesday, November 30, 2011

Installing shared printer remotely using VB Script

Installing shared printer remotely using VB Script

The below HTML code snippet can be used to install the shared printer remotely .

<html>
<title> Add Printer </title>
<head>
<script language="vbscript">
function AddPrinter()
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.AddWindowsPrinterConnection "<<Printer Path>>"
WshNetwork.SetDefaultPrinter "<<Printer Path>>"
Document.Write "Printer Installed Successfully , Please Close the Web Page"
end function
</script>
</head>
<body Onload="AddPrinter()">
Installing Selected Printer
</body>
</html>

Removing empty nodes from XML using xslt


Removing empty nodes from XML using xslt

The below XSLT can be used to remove the empty nodes from the XML file.

<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output omit-xml-declaration="yes" indent="yes" />
<xsl:template match="node()|SDLT">
<xsl:if test="count(descendant::text()[string-length(normalize-space(.))>0] | @*[string-length(.)>0])">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:if>
</xsl:template>
<xsl:template match="@*">
<xsl:copy />
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="normalize-space(.)" />
</xsl:template>
</xsl:stylesheet>