Inaccurate error message for parameter passing in Pipeline with enable_metadata_routing=True

### Describe the issue linked to the documentation

**The following error message is inaccurate:** 

```
Passing extra keyword arguments to Pipeline.transform is only supported if enable_metadata_routing=True, which you can set using sklearn.set_config.  
```

**This can easily be done using `**params` as described in the documentation for sklearn.pipeline:** https://scikit-learn.org/stable/modules/generated/sklearn.pipeline.Pipeline.html#sklearn.pipeline.Pipeline.fit 

**Please consider the following example:**

```py
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.pipeline import Pipeline
from scipy.sparse import csr_matrix
import pandas as pd
import numpy as np

class DummyTransformer(BaseEstimator, TransformerMixin):
    def __init__(self):
        self.feature_index_sec = None  # initialize attribute

    def transform(self, X, feature_index_sec=None, **fit_params):
        if feature_index_sec is None:
            raise ValueError("Missing required argument 'feature_index_sec'.")
            
        print(f"Transform Received feature_index_sec with shape: {feature_index_sec.shape}")
        return X

    def fit(self, X, y=None, feature_index_sec=None, **fit_params):
        print(f"Fit Received feature_index_sec with shape: {feature_index_sec.shape}")
        return self

    def fit_transform(self, X, y=None, feature_index_sec=None, **fit_params):
        self.fit(X, y, feature_index_sec, **fit_params)  # feature_index_sec is passed with other parameters
        return self.transform(X, feature_index_sec, **fit_params)

feature_matrix = csr_matrix(np.random.rand(10, 5))
train_idx = pd.DataFrame({'FileDate_ClosingPrice': np.random.rand(10)})

transformer = DummyTransformer()
pipe = Pipeline(steps=[('DummyTransformer', transformer)])

pipe.fit_transform(feature_matrix, DummyTransformer__feature_index_sec=train_idx)

# this line creates the error
pipe.transform(feature_matrix, DummyTransformer__feature_index_sec=train_idx)

```
**Which outputs:**

```
Fit Received feature_index_sec with shape: (10, 1)
Transform Received feature_index_sec with shape: (10, 1)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
File /tmp/test.py:35
     32 pipe.fit_transform(feature_matrix, DummyTransformer__feature_index_sec=train_idx)
     34 # this line creates the error
---> 35 pipe.transform(feature_matrix, DummyTransformer__feature_index_sec=train_idx)

File ~/micromamba/lib/python3.12/site-packages/sklearn/pipeline.py:896, in Pipeline.transform(self, X, **params)
    863 @available_if(_can_transform)
    864 def transform(self, X, **params):
    865     """Transform the data, and apply `transform` with the final estimator.
    866 
    867     Call `transform` of each transformer in the pipeline. The transformed
   (...)
    894         Transformed data.
    895     """
--> 896     _raise_for_params(params, self, "transform")
    898     # not branching here since params is only available if
    899     # enable_metadata_routing=True
    900     routed_params = process_routing(self, "transform", **params)

File ~/micromamba/lib/python3.12/site-packages/sklearn/utils/_metadata_requests.py:158, in _raise_for_params(params, owner, method)
    154 caller = (
    155     f"{owner.__class__.__name__}.{method}" if method else owner.__class__.__name__
    156 )
    157 if not _routing_enabled() and params:
--> 158     raise ValueError(
    159         f"Passing extra keyword arguments to {caller} is only supported if"
    160         " enable_metadata_routing=True, which you can set using"
    161         " `sklearn.set_config`. See the User Guide"
    162         " <https://scikit-learn.org/stable/metadata_routing.html> for more"
    163         f" details. Extra parameters passed are: {set(params)}"
    164     )

ValueError: Passing extra keyword arguments to Pipeline.transform is only supported if enable_metadata_routing=True, which you can set using `sklearn.set_config`. See the User Guide <https://scikit-learn.org/stable/metadata_routing.html> for more details. Extra parameters passed are: {'DummyTransformer__feature_index_sec'}
```

**Request**

- The error message should be updated to clarify that parameters can already be passed using the **params (e.g., StepName__param_name) syntax, which is unrelated to metadata routing.
- Additionally, I was unable to find any example of using enable_metadata_routing=True to pass parameters, either in the documentation or in the wild. It would be helpful if the documentation provided a working example of passing parameters using metadata routing, especially for custom transformers.

### Suggest a potential alternative/fix

_No response_

COMMENT:
Hi @jakemdrew,

<strike>can you please provide a reproducible of the error, so we can see what you had expected to work or where you thought the error message was incorrect? Thanks a lot for your efforts.</strike>

Edit: 
I now see. I will have a further look into this in the coming days.

Labels: Documentation