ph-schematron/src/main/java/com/helger/schematron/pure/exchange/PSWriterSettings.java
@Nonnull
  @ReturnsMutableCopy
  public static MapBasedNamespaceContext createNamespaceMapping (@Nonnull final PSSchema aSchema)
  {
    final MapBasedNamespaceContext ret = new MapBasedNamespaceContext ();
    ret.addDefaultNamespaceURI (CSchematron.NAMESPACE_SCHEMATRON);
    for (final PSNS aItem : aSchema.getAllNSs ())
      ret.addMapping (aItem.getPrefix (), aItem.getUri ());
    return ret;
  }
@Nonnull
  @ReturnsMutableCopy
  public static MapBasedNamespaceContext createNamespaceMapping (@Nonnull final PSSchema aSchema)
  {
    final MapBasedNamespaceContext ret = new MapBasedNamespaceContext ();
    ret.addDefaultNamespaceURI (CSchematron.NAMESPACE_SCHEMATRON);
    for (final PSNS aItem : aSchema.getAllNSs ())
      ret.addMapping (aItem.getPrefix (), aItem.getUri ());
    return ret;
  }
Helper method to extract the namespace mapping from the provided
Schematron.

@param aSchema
The schema to extract the namespace context from. May not be
<code>null</code>.
@return A non-<code>null</code> but maybe empty namespace context