translateLabelOnly context scope ss nsid p = do
  r <- translateLabelEx scope ss nsid p
  case r of
    L2.L2ExReferenceLabel _ l -> return l
    _ -> fail $ "Expected a label, not a value, in " ++ context ++ " at " ++ show (L1.l1RelOrAbsPIESS p)

-- | Translates an L1Expression to a L2Expression.
translateLabelOnly context scope ss nsid p = do
  r <- translateLabelEx scope ss nsid p
  case r of
    L2.L2ExReferenceLabel _ l -> return l
    _ -> fail $ "Expected a label, not a value, in " ++ context ++ " at " ++ show (L1.l1RelOrAbsPIESS p)

-- | Translates an L1Expression to a L2Expression.
translateLabelOnly context scope ss nsid p = do
  r <- translateLabelEx scope ss nsid p
  case r of
    L2.L2ExReferenceLabel _ l -> return l
    _ -> fail $ "Expected a label, not a value, in " ++ context ++ " at " ++ show (L1.l1RelOrAbsPIESS p)

-- | Translates an L1Expression to a L2Expression.