BEIJING - President Xi Jinping visited Hong Kong to attend a ceremony marking the 25th anniversary of its transfer to Chinese rule, his first trip outside the mainland since the pandemic began in early 2020, state-run media reported Thursday.