<?xml version="1.0"?>
<!--
$Id: print-methods.xsl,v 1.2 2004/01/22 19:27:29 jmates Exp $

Lists what ports (nominally for printing) are open.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.0">

  <xsl:output method="text"/>

  <xsl:variable name="newline">
    <xsl:text>
</xsl:text>
  </xsl:variable>

  <xsl:template match="/">
    <xsl:apply-templates select="//host"/>
  </xsl:template>

  <xsl:template match="host">
    <xsl:variable name="hostname">
<!-- TODO how deal with multiple <hostname/> subelements? -->
      <xsl:value-of select="hostnames/hostname/@name"/>
    </xsl:variable>

<!-- key output off hostname -->
    
    <xsl:for-each select="ports[port/state/@state = 'open']">
      <xsl:if test="port/@portid = '631'">
        <xsl:value-of select="$hostname"/>
        <xsl:text> ipp t</xsl:text>
        <xsl:value-of select="$newline"/>
      </xsl:if>
      <xsl:if test="port/@portid = '9100'">
        <xsl:value-of select="$hostname"/>
        <xsl:text> socket 9100</xsl:text>
        <xsl:value-of select="$newline"/>
      </xsl:if>
      <xsl:if test="port/@portid = '515'">
        <xsl:value-of select="$hostname"/>
        <xsl:text> lpd t</xsl:text>
        <xsl:value-of select="$newline"/>
      </xsl:if>
    </xsl:for-each>
    
  </xsl:template>

</xsl:stylesheet>
