I'm running into a bit of a pickle where I'm working out network masks into shorthand (ie. 255.255.255.0
= /24
)
I did a whole bunch of googling, and weirdly enough, no one has ever asked how to compute this in XSL.
So I came up with my own solution: why not do a whole bunch of statements like:
<xsl:choose>
<xsl:when test="'255.255.255.0'">
<xsl:value-of select="'/24'"/>
</xsl:when>
<xsl:when test="'255.255.0.0'">
<xsl:value-of select="'/16'"/>
</xsl:when>
...
and so on and so forth. Then I realized. I think I'm thinking too much outside the box. There has to be a solution to calculate this. There are too many possibilities of a network mask. Does anyone know how to calculate it?