%define	xhtml11dir	%{_datadir}/sgml/xhtml/xhtml-dtd-1.1
%define catalog_name	%{name}-%{version}-%{release}.cat

Name: xhtml-dtd11
Version: 1.0
Release: 1%{?_dist_release}
Group: Applications/Text
Summary: XML document type definition for XHTML 1.1
License: distributable
#Provides: html-dtd
Requires: sgml-common >= 0.5
BuildRoot: %{_tmppath}/%{name}-%{version}
BuildArch: noarch
Source0: http://www.w3.org/TR/xhtml11/xhtml11.tgz
Source1: http://www.w3.org/Consortium/Legal/copyright-documents-19990405.html
Url: http://www.w3.org/TR/xhtml11/

%description
XML document type definition for XHTML 1.1

%prep
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
rm -rf ${RPM_BUILD_DIR}/%{name}-%{version}

%setup -c -n xhtml11-20010531
cp -a %{SOURCE1} .

%build

%install
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
[ "%{buildroot}" != "/" ] && \
            mkdir -p %{buildroot}%{xhtml11dir}

pushd xhtml11-20010531/DTD
install -m0644 *.mod %{buildroot}%{xhtml11dir}
install -m0644 *.dtd %{buildroot}%{xhtml11dir}
install -m0644 *.dcl %{buildroot}%{xhtml11dir}
install -m0644 *.cat %{buildroot}%{xhtml11dir}
ln -s  xhtml11.cat %{buildroot}%{xhtml11dir}/catalog
popd

%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
rm -rf ${RPM_BUILD_DIR}/%{name}-%{version}


%post
# Update the centralized catalog corresponding to this version of the DTD
/usr/bin/install-catalog --add /etc/sgml/%{catalog_name} %{xhtml11dir}/catalog > /dev/null

# Update the link to the current version of the DTD
ln -s -f /etc/sgml/%{catalog_name} /etc/sgml/xhtml.cat

%postun
# Update the centralized catalog corresponding to this version of the DTD
/usr/bin/install-catalog --remove /etc/sgml/%{catalog_name} %{xhtml11dir}/catalog > /dev/null

# Update the link to the current version of the DTD
if [ ! -e /etc/sgml/%{catalog_name} ]; then
    rm -f /etc/sgml/xhtml.cat
    OTHERCAT=`ls /etc/sgml/xhtml-?.*.cat 2> /dev/null | head --lines 1`
    if [ -n "$OTHERCAT" ]; then ln -s $OTHERCAT /etc/sgml/xhtml.cat; fi
fi

%files
%defattr (-,root,root)
%doc copyright-documents-19990405.html xhtml11-20010531/*.*
%{xhtml11dir}

%changelog
* Wed Oct 15 2008 Shu KONNO <owa@bg.wakwak.com> 1.0-1vl5
- applied new versioning policy

* Mon Mar 24 2003 IWAI Masaharu <iwai@alib.jp> 1.0-0vl1
- first release

