Class XSLTransform (Word VBA)

The class XSLTransform represents a single registered Extensible Stylesheet Language Transformation (XSLT).

Set

To use a XSLTransform class variable it first needs to be instantiated, for example

Dim xsl as XSLTransform
Set xsl = Application.XMLNamespaces(1).DefaultTransform

The following procedures can be used to set variables of type XSLTransform: XMLNamespace.DefaultTransform, XSLTransforms.Add, XSLTransforms.Item and XMLNamespace.XSLTransforms

For Each

Here is an example of processing the XSLTransform items in a collection.

Dim xsl As XSLTransform
For Each xsl In Application.XMLNamespaces.XSLTransforms
	
Next xsl

Alias

Returns a String that represents the display name for the specified object.

Syntax : expression.Alias (AllUsers)

Delete

Deletes the specified Extensible Stylesheet Language Transformation (XSLT) from the list of avaliable XSLTs.

Application.XMLNamespaces(1).DefaultTransform.Delete

ID

Returns a String containing the GUID assigned to the currentXSLTransform object.

Dim strID As String
strID = Application.XMLNamespaces(1).DefaultTransform.ID

Location

Returns or sets a String that represents the physical location of the XSL transform for the namespace of an XML schema in the Schema Library.

Syntax : expression.Location (AllUsers)

AllUsers: Specifies whether to return the location for all users. False returns the location for only the current user, which may be different than the location for all users.

Application.XMLNamespaces(1).DefaultTransform.Location =

Parent

Returns an object that represents the parent object of the specified XSLTransform object.

Dim objParent As Object
Set objParent = Application.XMLNamespaces(1).DefaultTransform.Parent

XSLTransforms.Add

Returns an XSLTransform object that represents an Extensible Stylesheet Language Transformation (XSLT) added to the collection of XSLTs for a specified schema.

Syntax : expression.Add (Location, Alias, InstallForAllUsers)

Sub AddXSLT() 
 Dim objSchema As XMLNamespace 
 Dim objTransform As XSLTransform 
 
 Set objSchema = Application.XMLNamespaces("SimpleSample") 
 Set objTransform = objSchema.XSLTransforms _ 
 .Add("c:\schemas\simplesample.xsl") 
 
End Sub

Arguments

The following argument is required

Location (String) - The path and file name of the XSLT. This may be a local file path, a network path, or an Internet address.

The following arguments are optional

Alias (String) - The name of the XSLT as it appears in the Schema Library.

InstallForAllUsers (Boolean) - True if all users that log on to a computer can access and use the new schema. The default is False.

XSLTransforms.Count

Returns a Long that represents the number of XSLTransforms in the collection.

Dim lngCount As Long
lngCount = Application.XMLNamespaces(1).XSLTransforms.Count

XSLTransforms.Item

Returns an XSLTransform object in a collection.

Syntax : expression.Item (Index)

Index: The individual object to be returned. Can be a Long indicating the ordinal position or a String representing the name of the individual object.

Dim xsl As XSLTransform
Set xsl = Application.XMLNamespaces(1).XSLTransforms(Index:=1)

XSLTransforms.Parent

Returns an object that represents the parent object of the specified XSLTransforms object.

Dim objParent As Object
Set objParent = Application.XMLNamespaces(1).XSLTransforms.Parent