Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
3.1 KiB

  1. <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl" language="VBScript" >
  2. <!-- Copyright (c) 2001 Microsoft Corporation -->
  3. <xsl:script><![CDATA[
  4. Option Explicit
  5. 'This stylesheet formats DMTF XML encoded CIM objects into a tabular
  6. 'format using carriage returns and space characters only.
  7. Dim sPXML
  8. Dim bFirst
  9. Dim sTs(128)
  10. Dim lens(128)
  11. Dim iLens
  12. Dim iLensMax
  13. Dim sVs(2048, 128)
  14. Dim iRow
  15. Function PadIt(ilen)
  16. Dim s
  17. Dim i
  18. Dim sp
  19. i = Abs(ilen) + 2
  20. If i > 200 Then
  21. While i > 0
  22. s = s & " "
  23. i = i - 1
  24. Wend
  25. PadIt = s
  26. Else
  27. PadIt = Left(" ", i)
  28. End If
  29. End Function
  30. Function DispIt1(n)
  31. If Len(sPXML) = 0 Then
  32. sPXML = Me.ParentNode.xml
  33. bFirst = True
  34. End If
  35. If Me.ParentNode.xml <> sPXML Then
  36. sPXML = Me.ParentNode.xml
  37. bFirst = False
  38. iLensMax = iLens
  39. iLens = 0
  40. iRow = iRow + 1
  41. End If
  42. If bFirst Then
  43. 'this is the first row - set up the headers
  44. sTs(iLens) = Me.Attributes(0).Value
  45. Else
  46. If sTs(iLens) <> Me.Attributes(0).Value Then
  47. 'This is going to be messy - Find it or add it on the end
  48. End If
  49. End If
  50. sVs(iRow, iLens) = Me.nodeTypedValue
  51. iLens = iLens + 1
  52. End Function
  53. Function DispIt2(n)
  54. Dim sT
  55. Dim sV
  56. Dim i
  57. Dim j
  58. Dim k
  59. 'Determine the column widths
  60. 'look at the column headers first
  61. iLensMax = iLens
  62. iLens = 0
  63. iRow = iRow + 1
  64. While i < iLensMax
  65. k = Len(sTs(i))
  66. If k > lens(i) Then
  67. lens(i) = k
  68. End If
  69. i = i + 1
  70. Wend
  71. 'look at the values
  72. i = 0
  73. While i < iRow
  74. j = 0
  75. While j < iLensMax
  76. k = Len(sVs(i, j))
  77. If k > lens(j) Then
  78. lens(j) = k
  79. End If
  80. j = j + 1
  81. Wend
  82. i = i + 1
  83. Wend
  84. 'set up the column headers
  85. i = 0
  86. While i < iLensMax
  87. j = lens(i)
  88. j = j - Len(sTs(i))
  89. sT = sT & sTs(i) & PadIt(j)
  90. i = i + 1
  91. Wend
  92. i = 0
  93. While i < iRow
  94. j = 0
  95. While j < iLensMax
  96. k = lens(j) - Len(sVs(i, j))
  97. sV = sV & sVs(i, j) & PadIt(k)
  98. j = j + 1
  99. Wend
  100. sV = sV & vbCrLf
  101. i = i + 1
  102. Wend
  103. DispIt2 = sT & vbCrLf & sV
  104. End Function
  105. ]]></xsl:script>
  106. <xsl:template match="/"><xsl:apply-templates select="//INSTANCE"/><xsl:eval language="VBScript">DispIt2(this)</xsl:eval></xsl:template>
  107. <xsl:template match="INSTANCE"><xsl:apply-templates select="PROPERTY"/></xsl:template>
  108. <xsl:template match="PROPERTY"><xsl:eval language="VBScript">DispIt1(this)</xsl:eval></xsl:template>
  109. </xsl:stylesheet>