The type attribute is used to associate either a standard or user-defined simple type or a complex type in a declaration. Examples would be defining an attribute of type="string" or type="integer", something like that.
While the ref attribute is used in a declaration to associate another declaration of element/attribute which has a type. Its like declaring the type only indirectly. I would read this as 'I am of the same type as that other element'. Examples of the use of the ref attribute would be say a declaration of the Shipping-Address and Billing-Address elements. You declare the Shipping-Address element using the type attribute and associate it to a user-defined complex-type. Once that is done, you can declare the Billing-Address using the ref attribute and declare that the Billing-Address is the same type as the Shipping-Address element.
<!-- ...... declare complex type AddressType..... --> <xsd:element name="Shipping-Address" type="AddressType"/> <!-- ...... other declarations ..... --> <xsd:element name="Billing-Address" ref="Shipping-Address"/> <!-- ...... other declarations ..... -->
The ref attribute is mostly used to associate types from different namespaces.