Use Seil to map caps lock to some key like F19. Then install Karabiner and save a file like this as ~/Library/Application Support/Karabiner/private.xml
:
<?xml version="1.0"?>
<root>
<item>
<name>custom</name>
<identifier>custom</identifier>
<autogen>__KeyToKey__ KeyCode::F19, ModifierFlag::NONE, KeyCode::KEY_9, ModifierFlag::SHIFT_L</autogen>
<autogen>__KeyToKey__ KeyCode::F19, VK_SHIFT, KeyCode::KEY_0, ModifierFlag::SHIFT_L</autogen>
</item>
</root>
Then open the Karabiner application, press the ReloadXML button, and click the checkbox for the setting.
If others search for how to for example map pressing caps lock to escape and holding caps lock to control, use KeyOverlaidModifier
:
__KeyOverlaidModifier__ KeyCode::F19, KeyCode::CONTROL_L, KeyCode::ESCAPE