There's a lot going on here, consider replacing `it.@type.text()` with the temporary variable `typeName ` e.g.
`typeName.substring(typeName.indexOf(":") + 1).capitalize()` and extracting this line to a method.