catalog2xml 709 B

1234567891011121314151617181920212223
  1. #!/bin/sh
  2. PATH=@l_prefix@/bin:${PATH}
  3. echo "<?xml version='1.0'?>"
  4. echo '<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">'
  5. echo '<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">'
  6. if test $# != 0 ; then
  7. sed -n \
  8. -e ':input' \
  9. -e '/PUBLIC[^"]*$/{ N; b input }' \
  10. -e '/PUBLIC[^"]*"[^"]*$/{ N; b input }' \
  11. -e '/PUBLIC[^"]*"[^"]*"[^"]*$/{ N; b input }' \
  12. -e '/PUBLIC[^"]*"[^"]*"[^"]*"[^"]*$/{ N; b input }' \
  13. -e 's/\n/ /g' \
  14. -e 's/^ *\(--.*--\)/<!\1>/gp' \
  15. -e 's/PUBLIC *\("[^"]*"\) *\("[^"]*"\)/<public publicId=\1 uri=\2\/>/gp' \
  16. "$@"
  17. fi
  18. echo '</catalog>'